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

Public Member Functions

 __construct ( $functionCall, $list=null)
 Create a new ZTypedMap instance.
 
 isValid ()
 Valid if each ZTypedPair in the ZTypedList is of the same type as the map's type.
 
 getKeyType ()
 Returns the type of the keys of this ZTypedMap.
 
 getValueType ()
 Returns the type of the values of this ZTypedMap.
 
 getList ()
 Returns the ZTypedList.
 
 getValueGivenKey (ZObject $key)
 Returns the ZTypedList.
 
 setValueForKey (ZObject $key, ?ZObject $value)
 Ensures there is an entry for the given key / value in the ZMap.
 
- 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.
 
 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 ()
 @inheritDoc
 
static buildType ( $keyType, $valueType)
 Build the function call that defines the type of this Typed Map.
 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\Extension\WikiLambda\ZObjects\ZObject
const FORM_CANONICAL = 1
 
const FORM_NORMAL = 2
 
- Protected Attributes inherited from MediaWiki\Extension\WikiLambda\ZObjects\ZObject
 $type = null
 
 $data = []
 
 $linkedZObjects = []
 

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::__construct ( $functionCall,
$list = null )

Create a new ZTypedMap instance.

Parameters
ZFunctionCall$functionCall
ZTypedList | null$list

Member Function Documentation

◆ buildType()

static MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::buildType ( $keyType,
$valueType )
static

Build the function call that defines the type of this Typed Map.

Parameters
string$keyType
string$valueType
Returns
ZFunctionCall

◆ getDefinition()

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

@inheritDoc

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

◆ getKeyType()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::getKeyType ( )

Returns the type of the keys of this ZTypedMap.

Returns
ZReference The type of the keys

◆ getList()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::getList ( )

Returns the ZTypedList.

Returns
?ZTypedList The list of typed pairs

◆ getValueGivenKey()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::getValueGivenKey ( ZObject $key)

Returns the ZTypedList.

Parameters
ZObject$key
Returns
?ZObject The value at the key, if available

◆ getValueType()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::getValueType ( )

Returns the type of the values of this ZTypedMap.

Returns
ZReference The type of the values

◆ isValid()

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

Valid if each ZTypedPair in the ZTypedList is of the same type as the map's type.

@inheritDoc

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

◆ setValueForKey()

MediaWiki\Extension\WikiLambda\ZObjects\ZTypedMap::setValueForKey ( ZObject $key,
?ZObject $value )

Ensures there is an entry for the given key / value in the ZMap.

If there is already an entry for the given key, overwrites the corresponding value. Otherwise, creates a new entry. N.B.: Modifies the content of the ZMap's list in place.

TODO (T302015): When ZMap keys are extended beyond Z6/Z39, update accordingly

Parameters
ZObject$keyA Z6 or Z39 instance to serve as the key
?ZObject$valueA ZObject to set; if null, no object is set
+ Here is the call graph for this function:

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