Wikibase
MediaWiki Wikibase extension
|
Factory service for obtaining a SnakFormatter for a desired output format. More...
Public Member Functions | |
__construct (array $snakFormatterConstructorCallbacks, OutputFormatValueFormatterFactory $valueFormatterFactory, PropertyDataTypeLookup $propertyDataTypeLookup, DataTypeFactory $dataTypeFactory) | |
getSnakFormatter ( $format, FormatterOptions $options) | |
Returns an SnakFormatter for rendering snaks in the desired format using the given options. | |
Private Member Functions | |
getMessage ( $key, $languageCode) | |
createSnakFormatters ( $format, FormatterOptions $options) | |
Instantiate SnakFormatters based on the constructor callbacks passed to the constructor. | |
Private Attributes | |
$snakFormatterConstructorCallbacks | |
$valueFormatterFactory | |
$propertyDataTypeLookup | |
$dataTypeFactory | |
Factory service for obtaining a SnakFormatter for a desired output format.
Implemented based on constructor callbacks and a default SnakFormatter implementation that uses TypedValueFormatters.
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::__construct | ( | array | $snakFormatterConstructorCallbacks, |
OutputFormatValueFormatterFactory | $valueFormatterFactory, | ||
PropertyDataTypeLookup | $propertyDataTypeLookup, | ||
DataTypeFactory | $dataTypeFactory | ||
) |
callable[] | $snakFormatterConstructorCallbacks | An associative array mapping property data type IDs to callbacks. The callbacks will be invoked with two parameters: the desired output format, and the FormatterOptions. Each callback must return an instance of SnakFormatter. |
OutputFormatValueFormatterFactory | $valueFormatterFactory | |
PropertyDataTypeLookup | $propertyDataTypeLookup | |
DataTypeFactory | $dataTypeFactory |
|
private |
Instantiate SnakFormatters based on the constructor callbacks passed to the constructor.
string | $format | |
FormatterOptions | $options |
|
private |
string | $key | |
string | $languageCode |
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::getSnakFormatter | ( | $format, | |
FormatterOptions | $options | ||
) |
Returns an SnakFormatter for rendering snaks in the desired format using the given options.
string | $format | Use the SnakFormatter::FORMAT_XXX constants. |
FormatterOptions | $options |
RuntimeException | |
InvalidArgumentException |
|
private |
|
private |
|
private |
|
private |