Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory Class Reference

Factory for LabelDescriptionLookup objects based on FormatterOptions. More...

Public Member Functions

 __construct (TermLookup $termLookup)
 
 getLabelDescriptionLookup (FormatterOptions $options)
 

Public Attributes

const OPT_LANGUAGE_FALLBACK_CHAIN = 'languages'
 

Private Member Functions

 newLanguageFallbackLabelDescriptionLookup (FormatterOptions $options)
 
 newLanguageLabelDescriptionLookup (FormatterOptions $options)
 

Private Attributes

 $termLookup
 

Detailed Description

Factory for LabelDescriptionLookup objects based on FormatterOptions.

The LabelDescriptionLookup is created based on the values of the options OPT_LANGUAGE_FALLBACK_CHAIN, and ValueFormatter::OPT_LANG:

  • If OPT_LANGUAGE_FALLBACK_CHAIN is set, a LanguageFallbackLabelDescriptionLookup will be created byed on the LanguageFallbackChain contained in that option.
  • If ValueFormatter::OPT_LANG is set, a LanguageLabelDescriptionLookup is created
  • If none of these options is set, an InvalidArgumentException is thrown.
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::__construct ( TermLookup  $termLookup)

Member Function Documentation

◆ getLabelDescriptionLookup()

Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::getLabelDescriptionLookup ( FormatterOptions  $options)
Parameters
FormatterOptions$options
Exceptions
InvalidArgumentException
Returns
LabelDescriptionLookup

◆ newLanguageFallbackLabelDescriptionLookup()

Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::newLanguageFallbackLabelDescriptionLookup ( FormatterOptions  $options)
private

◆ newLanguageLabelDescriptionLookup()

Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::newLanguageLabelDescriptionLookup ( FormatterOptions  $options)
private

Member Data Documentation

◆ $termLookup

Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::$termLookup
private

◆ OPT_LANGUAGE_FALLBACK_CHAIN

const Wikibase\Lib\Formatters\FormatterLabelDescriptionLookupFactory::OPT_LANGUAGE_FALLBACK_CHAIN = 'languages'

The documentation for this class was generated from the following file: