WikiLambda
MediaWiki WikiLambda extension
|
Public Member Functions | |
__construct ( $type) | |
Construct a new ZObject instance. | |
isValid () | |
Validate this ZObject against our schema, to prevent creation and saving of invalid items. | |
getValueByKey (string $key) | |
Fetch value of given key from the current ZObject. | |
setValueByKey (string $key, ZObject $value) | |
Set a value of given key in the current ZObject. | |
isBuiltin () | |
Returns whether this ZObject is a builtin class. | |
isTypeReference () | |
Returns whether the object type is a ZReference that points to a type. | |
isTypeFunctionCall () | |
Returns whether the object type is a ZFunctionCall that resolves to a type. | |
getZTypeObject () | |
Returns either the ZReference or the ZFunctionCall that contain the type of this ZObject (Z1K1) | |
getZType () | |
Returns a string with the Zid representing the type of this ZObject. | |
getZValue () | |
Return the untyped content of this ZObject. | |
getLinkedZObjects () | |
Return all ZObject Zids that are linked to the current ZObject. | |
getSerialized ( $form=self::FORM_CANONICAL) | |
Convert this ZObject into its serialized canonical representation. | |
getHumanReadable ( $language=null) | |
Convert this ZObject into human readable object by translating all keys and references into the preferred language or its fallbacks. | |
__toString () | |
Over-ride the default __toString() method to serialise ZObjects into a JSON representation. | |
Static Public Member Functions | |
static | getDefinition () |
Provide this ZObject's schema. | |
Public Attributes | |
const | FORM_CANONICAL = 1 |
const | FORM_NORMAL = 2 |
Protected Attributes | |
$type = null | |
$data = [] | |
$linkedZObjects = [] | |
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::__construct | ( | $type | ) |
Construct a new ZObject instance.
This top-level class has a number of Type-specific sub- classes for built-in representations, and is mostly intended to represent instances of wiki-defined types.
This constructor should only be called by ZObjectFactory (and test code), and not directly. Validation of inputs to this and all other ZObject constructors is left to ZObjectFactory.
ZObject | $type | ZReference or ZFunctionCall that resolves to the type of this ZObject |
Reimplemented in MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZKeyReference, MediaWiki\Extension\WikiLambda\ZObjects\ZReference, MediaWiki\Extension\WikiLambda\ZObjects\ZQuote, and MediaWiki\Extension\WikiLambda\ZObjects\ZString.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::__toString | ( | ) |
Over-ride the default __toString() method to serialise ZObjects into a JSON representation.
|
static |
Provide this ZObject's schema.
Reimplemented in MediaWiki\Extension\WikiLambda\ZObjects\ZError, MediaWiki\Extension\WikiLambda\ZObjects\ZFunction, MediaWiki\Extension\WikiLambda\ZObjects\ZFunctionCall, MediaWiki\Extension\WikiLambda\ZObjects\ZKey, MediaWiki\Extension\WikiLambda\ZObjects\ZKeyReference, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject, MediaWiki\Extension\WikiLambda\ZObjects\ZQuote, MediaWiki\Extension\WikiLambda\ZObjects\ZReference, MediaWiki\Extension\WikiLambda\ZObjects\ZResponseEnvelope, MediaWiki\Extension\WikiLambda\ZObjects\ZString, MediaWiki\Extension\WikiLambda\ZObjects\ZType, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedError, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedList, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap, and MediaWiki\Extension\WikiLambda\ZObjects\ZTypedPair.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getHumanReadable | ( | $language = null | ) |
Convert this ZObject into human readable object by translating all keys and references into the preferred language or its fallbacks.
Language | null | $language |
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getLinkedZObjects | ( | ) |
Return all ZObject Zids that are linked to the current ZObject.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getSerialized | ( | $form = self::FORM_CANONICAL | ) |
Convert this ZObject into its serialized canonical representation.
int | $form |
Reimplemented in MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZQuote, MediaWiki\Extension\WikiLambda\ZObjects\ZReference, MediaWiki\Extension\WikiLambda\ZObjects\ZString, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedError, and MediaWiki\Extension\WikiLambda\ZObjects\ZTypedList.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getValueByKey | ( | string | $key | ) |
Fetch value of given key from the current ZObject.
string | $key | The key to search for. |
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getZType | ( | ) |
Returns a string with the Zid representing the type of this ZObject.
If it has an anonymous type given by a ZFunctionCall, this method returns the Function Zid
TODO (T301553): Return the output type of the Function instead of its identifier
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getZTypeObject | ( | ) |
Returns either the ZReference or the ZFunctionCall that contain the type of this ZObject (Z1K1)
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::getZValue | ( | ) |
Return the untyped content of this ZObject.
Reimplemented in MediaWiki\Extension\WikiLambda\ZObjects\ZError, MediaWiki\Extension\WikiLambda\ZObjects\ZFunctionCall, MediaWiki\Extension\WikiLambda\ZObjects\ZKey, MediaWiki\Extension\WikiLambda\ZObjects\ZKeyReference, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject, MediaWiki\Extension\WikiLambda\ZObjects\ZQuote, MediaWiki\Extension\WikiLambda\ZObjects\ZReference, MediaWiki\Extension\WikiLambda\ZObjects\ZResponseEnvelope, MediaWiki\Extension\WikiLambda\ZObjects\ZString, MediaWiki\Extension\WikiLambda\ZObjects\ZType, and MediaWiki\Extension\WikiLambda\ZObjects\ZTypedList.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::isBuiltin | ( | ) |
Returns whether this ZObject is a builtin class.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::isTypeFunctionCall | ( | ) |
Returns whether the object type is a ZFunctionCall that resolves to a type.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::isTypeReference | ( | ) |
Returns whether the object type is a ZReference that points to a type.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::isValid | ( | ) |
Validate this ZObject against our schema, to prevent creation and saving of invalid items.
Reimplemented in MediaWiki\Extension\WikiLambda\ZObjects\ZError, MediaWiki\Extension\WikiLambda\ZObjects\ZFunction, MediaWiki\Extension\WikiLambda\ZObjects\ZFunctionCall, MediaWiki\Extension\WikiLambda\ZObjects\ZKey, MediaWiki\Extension\WikiLambda\ZObjects\ZKeyReference, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMonoLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualString, MediaWiki\Extension\WikiLambda\ZObjects\ZMultiLingualStringSet, MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject, MediaWiki\Extension\WikiLambda\ZObjects\ZQuote, MediaWiki\Extension\WikiLambda\ZObjects\ZReference, MediaWiki\Extension\WikiLambda\ZObjects\ZResponseEnvelope, MediaWiki\Extension\WikiLambda\ZObjects\ZString, MediaWiki\Extension\WikiLambda\ZObjects\ZType, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedError, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedList, MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap, and MediaWiki\Extension\WikiLambda\ZObjects\ZTypedPair.
MediaWiki\Extension\WikiLambda\ZObjects\ZObject::setValueByKey | ( | string | $key, |
ZObject | $value ) |
Set a value of given key in the current ZObject.
string | $key | The key to set. |
ZObject | $value | The value to set. |