MediaWiki Wikibase extension
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. More...

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.

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.
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\Repo\Normalization\CommonsMediaValueNormalizer, Wikibase\Lib\Normalization\StringValueNormalizer, and Wikibase\Lib\Normalization\CompositeDataValueNormalizer.

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