WikiLambda
MediaWiki WikiLambda extension
|
Static Public Member Functions | |
static | getIsoCode ( $code, $name, $class) |
static | isValidSerialisedZObject (string $input) |
static | isValidZObject ( $input) |
static | isValidZObjectList (array $input) |
static | isValidZObjectResolver ( $input) |
static | isValidZObjectRecord (stdClass $input) |
static | canonicalize ( $input) |
Canonicalizes a ZObject. | |
static | orderZKeyIDs (string $left, string $right) |
Compares IDs of ZKeys in an order. | |
static | canonicalizeZRecord (stdClass $input) |
Canonicalizes a record-like ZObject. | |
static | comparableString (string $input) |
Normalise and down-cast a label for database comparison by normalising Unicode, lower-casing, and collapsing accents. | |
static | filterZMultilingualStringsToLanguage ( $input, array $languages=[]) |
Filters ZObject to preferred language. | |
static | getPreferredMonolingualString (array $multilingualStr, array $languages) |
Filters ZMonolingualString to preferred language. | |
static | isTypeEqualTo ( $type1, $type2) |
Asserts whether two types are equivalent. | |
static | isValidZObjectReference (string $input) |
Is the input a ZObject reference key (e.g. | |
static | isNullReference (string $input) |
Is the input a null reference (Z0)? | |
static | isValidOrNullZObjectReference (string $input) |
Is the input a ZObject reference key (e.g. | |
static | isValidId (string $input) |
Is the input a valid possible identifier across WMF projects? | |
static | isValidZObjectKey (string $input) |
Is the input a ZObject reference key (e.g. | |
static | isValidZObjectGlobalKey (string $input) |
Is the input a global ZObject reference key (e.g. | |
static | getZObjectReferenceFromKey (string $input) |
Split out the ZObject reference from a given global reference key (e.g. | |
static | getIterativeList ( $list) |
Given an array or a ZTypedList, returns an array that can be iterated over. | |
static | getRequiredZids ( $zobject) |
static | getLabelOfReference ( $zid, $zobject, $lang) |
Returns the natural language label of a given Zid in the language passed as parameter or available fallback languages. | |
static | getLabelOfGlobalKey ( $key, $zobject, $lang) |
Returns the natural language label of a given type key, function argument or error key in the language passed as parameter or available fallback languages. | |
static | getLabelOfLocalKey ( $key, $zobject, $data, $lang) |
static | getLabelOfErrorTypeKey ( $key, $zobject, $lang) |
Returns the natural language label of a given ZKey in the language passed as parameter or available fallback languages. | |
static | getLabelOfTypeKey ( $key, $zobject, $lang) |
Returns the natural language label of a given ZKey in the language passed as parameter or available fallback languages. | |
static | getLabelOfFunctionArgument ( $key, $zobject, $lang) |
Returns the natural language label of a given ZArgument in the language passed as parameter or available fallback languages. | |
static | extractHumanReadableZObject ( $zobject, $data, $lang) |
Translates a serialized ZObject from Zids and ZKeys to natural language in the language passed as parameter or available fallback languages. | |
static | isCompatibleType (ZObject $accepted, ZObject $input) |
static | getZid ( $zobject) |
Get the ZID of the input if it's a persistent ZObject or a reference to one. | |
static | makeCacheKeyFromZObject ( $query) |
Walk a given input ZObject, and make a cache key constructed of its keys and values, with any ZObject referenced being expanded to also include its revision ID. | |
|
static |
Canonicalizes a ZObject.
string | array | stdClass | $input | decoded JSON object for a valid ZObject |
|
static |
Canonicalizes a record-like ZObject.
This trims and sorts the keys.
stdClass | $input | The decoded JSON object of a well-formed ZObject |
|
static |
Normalise and down-cast a label for database comparison by normalising Unicode, lower-casing, and collapsing accents.
TODO: To consider further changes.
string | $input | The input |
|
static |
Translates a serialized ZObject from Zids and ZKeys to natural language in the language passed as parameter or available fallback languages.
stdClass | array | string | $zobject | |
ZPersistentObject[] | $data | |
Language | $lang |
|
static |
Filters ZObject to preferred language.
Given a ZObject, reduces all its ZMultilingualStrings to only the preferred language or fallbacks.
array | stdClass | string | $input | decoded JSON object for a ZObject |
string[] | $languages | array of language Zids |
|
static |
string | $code | The MW language code |
string | $name | The plain text name of the language |
string | $class | The name of the class for the HTML element |
|
static |
Given an array or a ZTypedList, returns an array that can be iterated over.
array | ZTypedList | $list |
|
static |
Returns the natural language label of a given ZKey in the language passed as parameter or available fallback languages.
If not available, returns the non-translated ZKey.
string | $key | |
ZPersistentObject | $zobject | |
Language | $lang |
|
static |
Returns the natural language label of a given ZArgument in the language passed as parameter or available fallback languages.
If not available, returns the non-translated ZKey.
string | $key | |
ZPersistentObject | $zobject | |
Language | $lang |
|
static |
Returns the natural language label of a given type key, function argument or error key in the language passed as parameter or available fallback languages.
If not available, returns the untranslated key Id.
string | $key | |
ZPersistentObject | $zobject | |
Language | $lang |
|
static |
string | $key | |
\stdClass | $zobject | |
ZPersistentObject[] | $data | |
Language | $lang |
|
static |
Returns the natural language label of a given Zid in the language passed as parameter or available fallback languages.
If not available, returns the non-translated Zid.
string | $zid | |
ZPersistentObject | $zobject | |
Language | $lang |
|
static |
Returns the natural language label of a given ZKey in the language passed as parameter or available fallback languages.
If not available, returns the non-translated ZKey.
string | $key | |
ZPersistentObject | $zobject | |
Language | $lang |
|
static |
Filters ZMonolingualString to preferred language.
Returns the preferred ZMonolingualString of a ZMultilingualString given an array of preferred languages.
array | $multilingualStr | decoded JSON for a ZMultilingualString value (Z12K1) |
string[] | $languages | array of language Zids |
|
static |
string | array | \stdClass | $zobject |
|
static |
Get the ZID of the input if it's a persistent ZObject or a reference to one.
mixed | $zobject | The ZObject to examine for |
|
static |
Split out the ZObject reference from a given global reference key (e.g.
'Z1' from 'Z1K1').
string | $input |
|
static |
ZObject | $accepted | The ZObject we accept (typically a ZReference) |
ZObject | $input | A ZObject we're looking to evaluate whether it's compatible |
|
static |
Is the input a null reference (Z0)?
string | $input |
|
static |
Asserts whether two types are equivalent.
stdClass | string | $type1 | |
stdClass | string | $type2 |
|
static |
Is the input a valid possible identifier across WMF projects?
string | $input |
|
static |
Is the input a ZObject reference key (e.g.
Z1 or Z12345)?
string | $input |
|
static |
string | $input |
|
static |
string | array | stdClass | $input |
ZErrorException |
|
static |
Is the input a global ZObject reference key (e.g.
Z1K1)?
string | $input |
|
static |
Is the input a ZObject reference key (e.g.
Z1K1 or K12345)?
string | $input |
|
static |
array | $input |
ZErrorException |
|
static |
stdClass | $input |
ZErrorException |
|
static |
Is the input a ZObject reference key (e.g.
Z1 or Z12345)?
string | $input |
|
static |
mixed | $input |
ZErrorException |
|
static |
Walk a given input ZObject, and make a cache key constructed of its keys and values, with any ZObject referenced being expanded to also include its revision ID.
E.g. { "Z1K1": "Z7", "Z7K1": "Z801", "Z801K1": "Hey" } => 'Z1K1|Z7#1,Z7K1|Z801#2,Z801K1|Hey'
TODO (T338245): Is this cache key too broad? Can we simplify?
TODO (T338246): When a Z7/Function call, we also need to poison the key with the revision ID of the relevant implementation, but we don't know which was selected, as that's the call of the function orchestrator.
\stdClass | array | $query |
|
static |
Compares IDs of ZKeys in an order.
First come global ZIDs, then local ones. The globals are sorted first numerically by the Z-Number, and then by the K-Number.
string | $left | left key for comparision |
string | $right | right key for comparision |