WikiLambda
MediaWiki WikiLambda extension
Loading...
Searching...
No Matches
MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject Class Reference
+ Inheritance diagram for MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject:
+ Collaboration diagram for MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject:

Public Member Functions

 __construct ( $zid, $value, $label, $aliases=null, $description=null)
 Construct a ZPersistentObject instance.
 
 isValid ()
 @inheritDoc
 
 getZValue ()
 Get the generic content of the inner ZObject wrapped by this ZPersistentObject.
 
 validateDescriptionLength ( $length, $context=null)
 Validates the length of the description field for a persistent object.
 
 validateLabelLength ( $length, $context=null)
 Validates the length of the label field for a persistent object.
 
 getZid ()
 Get the Zid that identifies this ZPersistentObject.
 
 getInnerZObject ()
 Get the inner ZObject wrapped by this ZPersistentObject.
 
 getInternalZType ()
 Get the type Zid of the ZObject wrapped by this ZPersistentObject.
 
 getLabels ()
 Get the ZMultilingualString that contains the label of this ZPersistentObject.
 
 getLabel ( $language, $defaultToEnglish=false)
 Get the label for a given Language (or its fallback).
 
 getAliases ()
 Get the ZMultilingualStringSet that contains the aliases for this ZPersistentObject.
 
 getDescriptions ()
 Get the ZMultilingualString that contains the description of this ZPersistentObject.
 
 getDescription ( $language, $defaultToEnglish=false)
 Get the description for a given Language (or its fallback).
 
- Public Member Functions inherited from MediaWiki\Extension\WikiLambda\ZObjects\ZObject
 __construct ( $type)
 Construct a new ZObject instance.
 
 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.
 
 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 ()
 @inheritDoc
 

Protected Attributes

 $data = []
 
- Protected Attributes inherited from MediaWiki\Extension\WikiLambda\ZObjects\ZObject
 $type = null
 
 $data = []
 
 $linkedZObjects = []
 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\Extension\WikiLambda\ZObjects\ZObject
const FORM_CANONICAL = 1
 
const FORM_NORMAL = 2
 

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::__construct ( $zid,
$value,
$label,
$aliases = null,
$description = null )

Construct a ZPersistentObject instance.

Parameters
ZObject$zidZString representing the Zid that identifies this ZPersistentObject
ZObject$valueZObject to be wrapped in this ZPersistentObject
ZObject$labelZMultiLingualString that contains this ZPersistentObject's label
ZObject | null$aliasesZMultiLingualStringSet with this ZPersistentObject's aliases or null
ZObject | null$descriptionZMultiLingualString that contains this ZPersistentObject's description

Member Function Documentation

◆ getAliases()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getAliases ( )

Get the ZMultilingualStringSet that contains the aliases for this ZPersistentObject.

Returns
ZMultilingualStringSet The mulilingual stringset object with the aliases

◆ getDefinition()

static MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getDefinition ( )
static

@inheritDoc

Reimplemented from MediaWiki\Extension\WikiLambda\ZObjects\ZObject.

◆ getDescription()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getDescription ( $language,
$defaultToEnglish = false )

Get the description for a given Language (or its fallback).

Parameters
Language$languageLanguage in which to provide the description.
bool$defaultToEnglish
Returns
?string

◆ getDescriptions()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getDescriptions ( )

Get the ZMultilingualString that contains the description of this ZPersistentObject.

Returns
?ZMultilingualString The mulilingual string object with the description

◆ getInnerZObject()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getInnerZObject ( )

Get the inner ZObject wrapped by this ZPersistentObject.

Returns
ZObject The inner ZObject wrapped by this ZPersistentObject

◆ getInternalZType()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getInternalZType ( )

Get the type Zid of the ZObject wrapped by this ZPersistentObject.

TODO (T296822): The type can also be a function call.

Returns
string The type of the internal ZObject

◆ getLabel()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getLabel ( $language,
$defaultToEnglish = false )

Get the label for a given Language (or its fallback).

Parameters
Language$languageLanguage in which to provide the label.
bool$defaultToEnglish
Returns
?string

◆ getLabels()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getLabels ( )

Get the ZMultilingualString that contains the label of this ZPersistentObject.

Returns
ZMultilingualString The mulilingual string object with the label

◆ getZid()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getZid ( )

Get the Zid that identifies this ZPersistentObject.

Returns
string The persisted (or null) ZID

◆ getZValue()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::getZValue ( )

Get the generic content of the inner ZObject wrapped by this ZPersistentObject.

Returns
mixed The generic content of the ZObject wrapped by this ZPersistentObject.

Reimplemented from MediaWiki\Extension\WikiLambda\ZObjects\ZObject.

◆ isValid()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::isValid ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\WikiLambda\ZObjects\ZObject.

◆ validateDescriptionLength()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::validateDescriptionLength ( $length,
$context = null )

Validates the length of the description field for a persistent object.

Parameters
int$lengthThe maximum length allowed for the description.
MessageLocalizer | null$contextThe context of the action operation, for localisation of messages
Returns
array An array of invalid languages

◆ validateLabelLength()

MediaWiki\Extension\WikiLambda\ZObjects\ZPersistentObject::validateLabelLength ( $length,
$context = null )

Validates the length of the label field for a persistent object.

Parameters
int$lengthThe maximum length allowed for the label.
MessageLocalizer | null$contextThe context of the action operation, for localisation of messages
Returns
array An array of invalid languages

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