FIXME: this class is not a language fallback chain.
More...
|
| getValueArray ( $value, string $languageCode, ?string $sourceLanguageCode=null) |
|
FIXME: this class is not a language fallback chain.
It takes and uses a fallback chain. The name thus needs to be updated to not be misleading.
- Copyright
- GPL-2.0-or-later
- Author
- Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >
-
Thiemo Kreuz
◆ __construct()
Wikibase\Lib\TermLanguageFallbackChain::__construct |
( |
array | $chain, |
|
|
ContentLanguages | $termLanguages ) |
- Parameters
-
LanguageWithConversion[] | $chain | |
ContentLanguages | null | $termLanguages | PhanTypeMismatchDeclaredParam |
◆ extractPreferredValue()
Wikibase\Lib\TermLanguageFallbackChain::extractPreferredValue |
( |
array | $data | ) |
|
Try to fetch the best value in a multilingual data array.
- Parameters
-
string[] | array[] | $data | Multilingual data with language codes as keys |
- Exceptions
-
- Returns
- string[]|null of three items: array( 'value' => finally fetched and translated value 'language' => language code of the language which final value is in 'source' => language code of the language where the value is translated from ), or null when no "acceptable" data can be found.
◆ extractPreferredValueOrAny()
Wikibase\Lib\TermLanguageFallbackChain::extractPreferredValueOrAny |
( |
array | $data | ) |
|
Try to fetch the best value in a multilingual data array first.
If no "acceptable" value exists, return any value known.
- Parameters
-
string[] | array[] | $data | Multilingual data with language codes as keys |
- Returns
- string[]|null of three items: array( 'value' => finally fetched and translated value 'language' => language code of the language which final value is in 'source' => language code of the language where the value is translated from ), or null when no data with a valid language code can be found.
◆ getFallbackChain()
Wikibase\Lib\TermLanguageFallbackChain::getFallbackChain |
( |
| ) |
|
Get raw fallback chain as an array.
Semi-private for testing.
- Returns
- LanguageWithConversion[]
◆ getFetchLanguageCodes()
Wikibase\Lib\TermLanguageFallbackChain::getFetchLanguageCodes |
( |
| ) |
|
Return language codes to use when fetching entries from the database.
- See also
- LanguageWithConversion::getFetchLanguageCode
- Returns
- string[]
◆ getValueArray()
Wikibase\Lib\TermLanguageFallbackChain::getValueArray |
( |
| $value, |
|
|
string | $languageCode, |
|
|
?string | $sourceLanguageCode = null ) |
|
private |
- Parameters
-
string | string[] | $value | |
string | $languageCode | |
string | null | $sourceLanguageCode | |
- Returns
- string[]
◆ $chain
Wikibase\Lib\TermLanguageFallbackChain::$chain |
|
private |
The documentation for this class was generated from the following file: