Factory service for obtaining a SnakFormatter for a desired output format.
More...
|
| getMessage ( $key, $languageCode) |
|
| createSnakFormatters ( $format, FormatterOptions $options) |
| Instantiate SnakFormatters based on the constructor callbacks passed to the constructor. More...
|
|
Factory service for obtaining a SnakFormatter for a desired output format.
Implemented based on constructor callbacks and a default SnakFormatter implementation that uses TypedValueFormatters.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::__construct |
( |
array |
$snakFormatterConstructorCallbacks, |
|
|
OutputFormatValueFormatterFactory |
$valueFormatterFactory, |
|
|
PropertyDataTypeLookup |
$propertyDataTypeLookup, |
|
|
DataTypeFactory |
$dataTypeFactory |
|
) |
| |
- Parameters
-
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 | |
◆ createSnakFormatters()
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::createSnakFormatters |
( |
|
$format, |
|
|
FormatterOptions |
$options |
|
) |
| |
|
private |
Instantiate SnakFormatters based on the constructor callbacks passed to the constructor.
- Parameters
-
string | $format | |
FormatterOptions | $options | |
- Returns
- SnakFormatter[]
◆ getMessage()
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::getMessage |
( |
|
$key, |
|
|
|
$languageCode |
|
) |
| |
|
private |
- Parameters
-
string | $key | |
string | $languageCode | |
- Returns
- Message
◆ getSnakFormatter()
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::getSnakFormatter |
( |
|
$format, |
|
|
FormatterOptions |
$options |
|
) |
| |
Returns an SnakFormatter for rendering snaks in the desired format using the given options.
- Parameters
-
string | $format | Use the SnakFormatter::FORMAT_XXX constants. |
FormatterOptions | $options | |
- Exceptions
-
RuntimeException | |
InvalidArgumentException | |
- Returns
- SnakFormatter
◆ $dataTypeFactory
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::$dataTypeFactory |
|
private |
◆ $propertyDataTypeLookup
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::$propertyDataTypeLookup |
|
private |
◆ $snakFormatterConstructorCallbacks
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::$snakFormatterConstructorCallbacks |
|
private |
◆ $valueFormatterFactory
Wikibase\Lib\Formatters\OutputFormatSnakFormatterFactory::$valueFormatterFactory |
|
private |
The documentation for this class was generated from the following file: