Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Normalization\DataValueNormalizer Interface Reference

A service to create normalized versions of data values. More...

+ Inheritance diagram for Wikibase\Lib\Normalization\DataValueNormalizer:

Public Member Functions

 normalize (DataValue $value)
 Normalize the given value.
 

Detailed Description

A service to create normalized versions of data values.

Normalization should have the following properties:

  • Deterministic: Normalizing the same value should produce the same result.
  • Idempotent: Normalizing an already normalized value returns the same value (in terms of {
    See also
    DataValue::equals equals()}, not necessarily ===).

Member Function Documentation

◆ normalize()

Wikibase\Lib\Normalization\DataValueNormalizer::normalize ( DataValue $value)

Normalize the given value.

Parameters
DataValue$valueThe value to normalize. Every implementation must be able to handle every data value type without error, even if it’s just by returning the same value without modification.
Returns
DataValue A normalized version of the value. If the input value was not normalized, this must be a new object, since data values are immutable; if it was already normalized, this may be a new object or the same instance.

Implemented in Wikibase\Lib\Normalization\CompositeDataValueNormalizer, Wikibase\Lib\Normalization\StringValueNormalizer, and Wikibase\Repo\Normalization\CommonsMediaValueNormalizer.


The documentation for this interface was generated from the following file: