Wikibase
MediaWiki Wikibase extension
|
PropertyValueSnakFormatter is a formatter for PropertyValueSnaks. More...
Public Member Functions | |
__construct ( $format, ValueFormatter $valueFormatter, PropertyDataTypeLookup $typeLookup, DataTypeFactory $dataTypeFactory) | |
formatSnak (Snak $snak) | |
getFormat () | |
Private Member Functions | |
getDataValueTypeForPropertyDataType ( $dataTypeId) | |
Returns the expected value type for the given property data type. | |
formatValue (DataValue $value, $dataTypeId) | |
Calls the TypedValueFormatter passed to the constructor. | |
Private Attributes | |
$format | |
$valueFormatter | |
$typeLookup | |
$dataTypeFactory | |
Additional Inherited Members | |
Public Attributes inherited from Wikibase\Lib\Formatters\SnakFormatter | |
const | OPT_LANG = ValueFormatter::OPT_LANG |
Options key for controlling the output language. | |
const | FORMAT_PLAIN = 'text/plain' |
Output format types. | |
const | FORMAT_WIKI = 'text/x-wiki' |
const | FORMAT_HTML = 'text/html' |
const | FORMAT_HTML_DIFF = 'text/html; disposition=diff' |
const | FORMAT_HTML_VERBOSE = 'text/html; disposition=verbose' |
const | FORMAT_HTML_VERBOSE_PREVIEW = 'text/html; disposition=verbose-preview' |
const | OPT_ON_ERROR = 'on-error' |
Options key for controlling error handling. | |
const | ON_ERROR_WARN = 'warn' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause a warning to be show to the user. | |
const | ON_ERROR_FAIL = 'fail' |
Value for the OPT_ON_ERROR option indicating that recoverable errors should cause the formatting to fail with an exception. | |
PropertyValueSnakFormatter is a formatter for PropertyValueSnaks.
This is essentially a SnakFormatter adapter for TypedValueFormatter.
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::__construct | ( | $format, | |
ValueFormatter | $valueFormatter, | ||
PropertyDataTypeLookup | $typeLookup, | ||
DataTypeFactory | $dataTypeFactory ) |
string | $format | The name of this formatter's output format. Use the FORMAT_XXX constants defined in SnakFormatter. |
ValueFormatter | $valueFormatter | |
PropertyDataTypeLookup | $typeLookup | |
DataTypeFactory | $dataTypeFactory |
InvalidArgumentException |
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::formatSnak | ( | Snak | $snak | ) |
Formats the given Snak by looking up its property type and calling the ValueFormatter supplied to the constructor.
Snak | $snak |
PropertyDataTypeLookupException | |
InvalidArgumentException | |
MismatchingDataValueTypeException | |
FormattingException |
Implements Wikibase\Lib\Formatters\SnakFormatter.
|
private |
Calls the TypedValueFormatter passed to the constructor.
DataValue | $value | |
string | $dataTypeId |
FormattingException |
|
private |
Returns the expected value type for the given property data type.
string | $dataTypeId | A property data type id |
Wikibase\Lib\Formatters\PropertyValueSnakFormatter::getFormat | ( | ) |
Implements Wikibase\Lib\Formatters\SnakFormatter.
|
private |
|
private |
|
private |
|
private |