PropertyValueSnakFormatter is a formatter for PropertyValueSnaks.
More...
PropertyValueSnakFormatter is a formatter for PropertyValueSnaks.
This is essentially a SnakFormatter adapter for TypedValueFormatter.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
- Parameters
-
string | $format | The name of this formatter's output format. Use the FORMAT_XXX constants defined in SnakFormatter. |
ValueFormatter | $valueFormatter | |
PropertyDataTypeLookup | $typeLookup | |
DataTypeFactory | $dataTypeFactory | |
- Exceptions
-
◆ formatSnak()
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::formatSnak |
( |
Snak |
$snak | ) |
|
- See also
- SnakFormatter::formatSnak
Formats the given Snak by looking up its property type and calling the ValueFormatter supplied to the constructor.
- Parameters
-
- Exceptions
-
PropertyDataTypeLookupException | |
InvalidArgumentException | |
MismatchingDataValueTypeException | |
FormattingException | |
- Returns
- string Either plain text, wikitext or HTML, depending on the ValueFormatter provided.
Implements Wikibase\Lib\Formatters\SnakFormatter.
◆ formatValue()
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::formatValue |
( |
DataValue |
$value, |
|
|
|
$dataTypeId |
|
) |
| |
|
private |
Calls the TypedValueFormatter passed to the constructor.
- Parameters
-
- Exceptions
-
- Returns
- string Either plain text, wikitext or HTML, depending on the ValueFormatter provided.
◆ getDataValueTypeForPropertyDataType()
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::getDataValueTypeForPropertyDataType |
( |
|
$dataTypeId | ) |
|
|
private |
Returns the expected value type for the given property data type.
- Parameters
-
string | $dataTypeId | A property data type id |
- Returns
- string A value type
◆ getFormat()
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::getFormat |
( |
| ) |
|
◆ $dataTypeFactory
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::$dataTypeFactory |
|
private |
◆ $format
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::$format |
|
private |
◆ $typeLookup
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::$typeLookup |
|
private |
◆ $valueFormatter
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::$valueFormatter |
|
private |
The documentation for this class was generated from the following file: