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, MessageInLanguageProvider $messageInLanguageProvider) | |
getSnakFormatter ( $format, FormatterOptions $options) | |
Returns an SnakFormatter for rendering snaks in the desired format using the given options. | |
Private Member Functions | |
getMessage (string $key, string $languageCode) | |
createSnakFormatters ( $format, FormatterOptions $options) | |
Instantiate SnakFormatters based on the constructor callbacks passed to the constructor. | |
Private Attributes | |
$snakFormatterConstructorCallbacks | |
$valueFormatterFactory | |
$propertyDataTypeLookup | |
$dataTypeFactory | |
$messageInLanguageProvider | |
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, | ||
MessageInLanguageProvider | $messageInLanguageProvider ) |
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 | |
MessageInLanguageProvider | $messageInLanguageProvider |
|
private |
Instantiate SnakFormatters based on the constructor callbacks passed to the constructor.
string | $format | |
FormatterOptions | $options |
|
private |
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 |
|
private |