Wikibase
MediaWiki Wikibase extension
|
Dispatching snak formatter that makes it possible to special case certain Snaks based on the associated property's data type. More...
Public Member Functions | |
__construct (string $format, PropertyDataTypeLookup $dataTypeLookup, SnakFormatter $specialCaseSnakFormatter, SnakFormatter $fallbackSnakFormatter, array $specialCasedPropertyDataTypes) | |
formatSnak (Snak $snak) | |
getFormat () | |
Private Member Functions | |
getSnakDataType (Snak $snak) | |
Private Attributes | |
$format | |
$dataTypeLookup | |
$specialCaseSnakFormatter | |
$fallbackSnakFormatter | |
$specialCasedPropertyDataTypes | |
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. | |
Dispatching snak formatter that makes it possible to special case certain Snaks based on the associated property's data type.
Depending on that data type, we choose between a "special" SnakFormatter and a generic one.
Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter::__construct | ( | string | $format, |
PropertyDataTypeLookup | $dataTypeLookup, | ||
SnakFormatter | $specialCaseSnakFormatter, | ||
SnakFormatter | $fallbackSnakFormatter, | ||
array | $specialCasedPropertyDataTypes ) |
string | $format | One of the SnakFormatter::FORMAT_... constants. |
PropertyDataTypeLookup | $dataTypeLookup | |
SnakFormatter | $specialCaseSnakFormatter | Snak formatter to use for Snaks with a property data type in $specialCasedPropertyDataTypes. |
SnakFormatter | $fallbackSnakFormatter | |
array | $specialCasedPropertyDataTypes |
Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter::formatSnak | ( | Snak | $snak | ) |
Snak | $snak |
FormattingException | |
PropertyDataTypeLookupException |
Implements Wikibase\Lib\Formatters\SnakFormatter.
Wikibase\Lib\Formatters\BinaryOptionDispatchingSnakFormatter::getFormat | ( | ) |
Implements Wikibase\Lib\Formatters\SnakFormatter.
|
private |
Snak | $snak |
PropertyDataTypeLookupException |
|
private |
|
private |
|
private |
|
private |
|
private |