WikiLambda
MediaWiki WikiLambda extension
Loading...
Searching...
No Matches
MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry Class Reference

A registry service for ZObject implementations. More...

+ Inheritance diagram for MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry:
+ Collaboration diagram for MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry:

Public Member Functions

 register (string $key, string $type)
 Registers the given ZType id and name in the type cache.
 
 unregister (string $key)
 Removes the given ZType from the type cache, except for builtin types.
 
 getCachedZObjectKeys ()
 Get the array of the keys of the ZTypes stored in the cache.
 
 isZTypeBuiltIn (string $key)
 Whether the provided ZType is 'built-in' to the WikiLambda extension, and thus its validator is provided in PHP code.
 
 isZFunctionBuiltIn (string $key)
 Whether the provided ZFunction is 'built-in' to the WikiLambda extension, and thus its validator is provided in PHP code.
 
 getZFunctionBuiltInName (string $zid)
 Returns the class name given a built-in function Zid.
 
 isZObjectKeyCached (string $key)
 Whether the provided ZType is cached.
 
 isZObjectKeyKnown (string $key)
 Whether the provided ZType is known, either because it's a registered type or because it's persisted in the database.
 
 getZObjectTypeFromKey (string $key)
 Returns the ZType class name given its ZID.
 
 getCachedZObjectTypes ()
 Returns the array of names of the cached ZTypes.
 
 isZObjectTypeCached (string $type)
 Whether the given ZType is saved in the cache.
 
 isZObjectTypeKnown (string $type)
 Whether the given ZType is known, either because it's saved in the cache or because it is persisted in the database.
 
 getZObjectKeyFromType (string $type)
 Returns the ZType id of a given type.
 
 isZObjectInstanceOfType (ZObject $object, string $type)
 Checks if a given ZObject is an instance of a given type.
 
- Public Member Functions inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
 clear ()
 Utility method to clear the whole cache of a registry instance and set it to initial values.
 
 isZidCached (string $zid)
 Utility method to check if the given Zid is cached in the registry.
 

Public Attributes

const BUILTIN_ANY = 'Any'
 
const BUILTIN_STRING = 'String'
 
const BUILTIN_ARRAY = 'Array'
 
const BUILTIN_REFERENCE = 'Reference'
 
const BUILTIN_REFERENCE_NULLABLE = 'NullableReference'
 
const HACK_REFERENCE_TYPE = 'Reference(Type)'
 
const HACK_REFERENCE_LANGUAGE = 'Reference(Language)'
 
const HACK_LANGUAGE = 'Language'
 
const HACK_ARRAY_Z_KEY = 'Array(ZKey)'
 
const HACK_ARRAY_Z_STRING = 'Array(ZString)'
 
const HACK_ARRAY_Z_MONOLINGUALSTRING = 'Array(ZMonoLingualString)'
 
const HACK_ARRAY_Z_MONOLINGUALSTRINGSET = 'Array(ZMonoLingualStringSet)'
 
const Z_NULL_REFERENCE = 'Z0'
 
const Z_OBJECT = 'Z1'
 
const Z_OBJECT_TYPE = 'Z1K1'
 
const Z_PERSISTENTOBJECT = 'Z2'
 
const Z_PERSISTENTOBJECT_ID = 'Z2K1'
 
const Z_PERSISTENTOBJECT_VALUE = 'Z2K2'
 
const Z_PERSISTENTOBJECT_LABEL = 'Z2K3'
 
const Z_PERSISTENTOBJECT_ALIASES = 'Z2K4'
 
const Z_PERSISTENTOBJECT_DESCRIPTION = 'Z2K5'
 
const Z_KEY = 'Z3'
 
const Z_KEY_TYPE = 'Z3K1'
 
const Z_KEY_ID = 'Z3K2'
 
const Z_KEY_LABEL = 'Z3K3'
 
const Z_KEY_IS_IDENTITY = 'Z3K4'
 
const Z_TYPE = 'Z4'
 
const Z_TYPE_IDENTITY = 'Z4K1'
 
const Z_TYPE_KEYS = 'Z4K2'
 
const Z_TYPE_VALIDATOR = 'Z4K3'
 
const Z_TYPE_EQUALITY = 'Z4K4'
 
const Z_TYPE_RENDERER = 'Z4K5'
 
const Z_TYPE_PARSER = 'Z4K6'
 
const Z_TYPE_DESERIALISERS = 'Z4K7'
 
const Z_TYPE_SERIALISERS = 'Z4K8'
 
const Z_ERROR = 'Z5'
 
const Z_ERROR_TYPE = 'Z5K1'
 
const Z_ERROR_VALUE = 'Z5K2'
 
const Z_STRING = 'Z6'
 
const Z_STRING_VALUE = 'Z6K1'
 
const Z_FUNCTIONCALL = 'Z7'
 
const Z_FUNCTIONCALL_FUNCTION = 'Z7K1'
 
const Z_FUNCTION = 'Z8'
 
const Z_FUNCTION_ARGUMENTS = 'Z8K1'
 
const Z_FUNCTION_RETURN_TYPE = 'Z8K2'
 
const Z_FUNCTION_TESTERS = 'Z8K3'
 
const Z_FUNCTION_IMPLEMENTATIONS = 'Z8K4'
 
const Z_FUNCTION_IDENTITY = 'Z8K5'
 
const Z_REFERENCE = 'Z9'
 
const Z_REFERENCE_VALUE = 'Z9K1'
 
const Z_MONOLINGUALSTRING = 'Z11'
 
const Z_MONOLINGUALSTRING_LANGUAGE = 'Z11K1'
 
const Z_MONOLINGUALSTRING_VALUE = 'Z11K2'
 
const Z_MULTILINGUALSTRING = 'Z12'
 
const Z_MULTILINGUALSTRING_VALUE = 'Z12K1'
 
const Z_IMPLEMENTATION = 'Z14'
 
const Z_IMPLEMENTATION_FUNCTION = 'Z14K1'
 
const Z_IMPLEMENTATION_COMPOSITION = 'Z14K2'
 
const Z_IMPLEMENTATION_CODE = 'Z14K3'
 
const Z_IMPLEMENTATION_BUILTIN = 'Z14K4'
 
const Z_ARGUMENTDECLARATION = 'Z17'
 
const Z_ARGUMENTDECLARATION_TYPE = 'Z17K1'
 
const Z_ARGUMENTDECLARATION_ID = 'Z17K2'
 
const Z_ARGUMENTDECLARATION_LABEL = 'Z17K3'
 
const Z_TESTER = 'Z20'
 
const Z_TESTER_FUNCTION = 'Z20K1'
 
const Z_TESTER_CALL = 'Z20K2'
 
const Z_TESTER_VALIDATION = 'Z20K3'
 
const Z_RESPONSEENVELOPE = 'Z22'
 
const Z_RESPONSEENVELOPE_VALUE = 'Z22K1'
 
const Z_RESPONSEENVELOPE_METADATA = 'Z22K2'
 
const Z_MONOLINGUALSTRINGSET = 'Z31'
 
const Z_MONOLINGUALSTRINGSET_LANGUAGE = 'Z31K1'
 
const Z_MONOLINGUALSTRINGSET_VALUE = 'Z31K2'
 
const Z_MULTILINGUALSTRINGSET = 'Z32'
 
const Z_MULTILINGUALSTRINGSET_VALUE = 'Z32K1'
 
const Z_KEYREFERENCE = 'Z39'
 
const Z_KEYREFERENCE_VALUE = 'Z39K1'
 
const Z_DESERIALISER = 'Z46'
 
const Z_DESERIALISER_IDENTITY = 'Z46K1'
 
const Z_DESERIALISER_TYPE = 'Z46K2'
 
const Z_DESERIALISER_LANGUAGE = 'Z46K3'
 
const Z_DESERIALISER_TARGET = 'Z46K4'
 
const Z_DESERIALISER_CODE = 'Z46K5'
 
const Z_LANGUAGE = 'Z60'
 
const Z_LANGUAGE_CODE = 'Z60K1'
 
const Z_LANGUAGE_SECONDARYCODES = 'Z60K2'
 
const Z_PROGRAMMINGLANGUAGE = 'Z61'
 
const Z_SERIALISER = 'Z64'
 
const Z_SERIALISER_IDENTITY = 'Z64K1'
 
const Z_SERIALISER_TYPE = 'Z64K2'
 
const Z_SERIALISER_LANGUAGE = 'Z64K3'
 
const Z_SERIALISER_SOURCE = 'Z64K4'
 
const Z_SERIALISER_CODE = 'Z64K5'
 
const Z_QUOTE = 'Z99'
 
const Z_QUOTE_VALUE = 'Z99K1'
 
const Z_ERRORTYPE = 'Z50'
 
const Z_ERRORTYPE_KEYS = 'Z50K1'
 
const TERMINAL_KEYS
 
const DISALLOWED_ROOT_ZOBJECTS
 An array of ZTypes which are prohibited from creation by any user.
 
const IGNORE_KEY_VALUES_FOR_LABELLING
 
const SELF_REFERENTIAL_KEYS
 
const Z_CODE = 'Z16'
 
const Z_ARGUMENTREFERENCE = 'Z18'
 
const Z_UNIT = 'Z21'
 
const Z_NULL = 'Z23'
 
const Z_VOID = 'Z24'
 
const Z_VOID_INSTANCE = [ self::Z_OBJECT_TYPE => self::Z_UNIT ]
 
const Z_BOOLEAN = 'Z40'
 
const Z_BOOLEAN_VALUE = 'Z40K1'
 
const Z_BOOLEAN_TRUE = 'Z41'
 
const Z_BOOLEAN_FALSE = 'Z42'
 
const IGNORE_KEY_NORMALIZATION
 
const Z_FUNCTION_TYPED_LIST = 'Z881'
 
const Z_FUNCTION_TYPED_LIST_TYPE = 'Z881K1'
 
const Z_FUNCTION_TYPED_PAIR = 'Z882'
 
const Z_FUNCTION_TYPED_FIRST_TYPE = 'Z882K1'
 
const Z_FUNCTION_TYPED_SECOND_TYPE = 'Z882K2'
 
const Z_FUNCTION_TYPED_MAP = 'Z883'
 
const Z_FUNCTION_TYPED_MAP_KEY_TYPE = 'Z883K1'
 
const Z_FUNCTION_TYPED_MAP_VALUE_TYPE = 'Z883K2'
 
const Z_FUNCTION_ERRORTYPE_TO_TYPE = 'Z885'
 
const Z_FUNCTION_ERRORTYPE_TYPE = 'Z885K1'
 
const BUILT_IN_TYPE_FUNCTIONS
 

Protected Member Functions

 initialize ()
 Initialize ZTypeRegistry.
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
static singleton ()
 
static unregisterZid (string $zid)
 Unregisters the zid from any of the existing registry instances.
 
static clearAll ()
 Clears and re-initializes all existing registry instances.
 
- Protected Attributes inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
 $registry = []
 
 $type
 

Detailed Description

A registry service for ZObject implementations.

Member Function Documentation

◆ getCachedZObjectKeys()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::getCachedZObjectKeys ( )

Get the array of the keys of the ZTypes stored in the cache.

Returns
string[] Keys of the ZTypes stored in the cache

◆ getCachedZObjectTypes()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::getCachedZObjectTypes ( )

Returns the array of names of the cached ZTypes.

Returns
string[] Array of cached ZTypes

◆ getZFunctionBuiltInName()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::getZFunctionBuiltInName ( string $zid)

Returns the class name given a built-in function Zid.

Parameters
string$zidThe zid of the built-in ZFunction
Returns
?string Class name for the built-in, or null if not known

◆ getZObjectKeyFromType()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::getZObjectKeyFromType ( string $type)

Returns the ZType id of a given type.

Parameters
string$typeName of the ZType
Returns
string ZID of the ZType
Exceptions
ZErrorException

◆ getZObjectTypeFromKey()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::getZObjectTypeFromKey ( string $key)

Returns the ZType class name given its ZID.

Parameters
string$keyThe key of the ZType to check
Returns
string Class name for the ZType
Exceptions
ZErrorException

◆ initialize()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::initialize ( )
protected

Initialize ZTypeRegistry.

Reimplemented from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry.

◆ isZFunctionBuiltIn()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZFunctionBuiltIn ( string $key)

Whether the provided ZFunction is 'built-in' to the WikiLambda extension, and thus its validator is provided in PHP code.

Parameters
string$keyThe key of the ZFunction to check.
Returns
bool

◆ isZObjectInstanceOfType()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZObjectInstanceOfType ( ZObject $object,
string $type )

Checks if a given ZObject is an instance of a given type.

Parameters
ZObject$object
string$typeZID of the type to test
Returns
bool
Exceptions
ZErrorException

◆ isZObjectKeyCached()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZObjectKeyCached ( string $key)

Whether the provided ZType is cached.

Parameters
string$keyThe key of the ZType to check
Returns
bool

◆ isZObjectKeyKnown()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZObjectKeyKnown ( string $key)

Whether the provided ZType is known, either because it's a registered type or because it's persisted in the database.

If the type is not yet cached but it's a valid type, it registers it.

Parameters
string$keyThe key of the ZType to check
Returns
bool

◆ isZObjectTypeCached()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZObjectTypeCached ( string $type)

Whether the given ZType is saved in the cache.

Parameters
string$typeName of the ZType
Returns
bool

◆ isZObjectTypeKnown()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZObjectTypeKnown ( string $type)

Whether the given ZType is known, either because it's saved in the cache or because it is persisted in the database.

Parameters
string$typeName of the ZType
Returns
bool

◆ isZTypeBuiltIn()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::isZTypeBuiltIn ( string $key)

Whether the provided ZType is 'built-in' to the WikiLambda extension, and thus its validator is provided in PHP code.

Parameters
string$keyThe key of the ZType to check.
Returns
bool

◆ register()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::register ( string $key,
string $type )

Registers the given ZType id and name in the type cache.

Parameters
string$key
string$type
Exceptions
ZErrorException

Reimplemented from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry.

+ Here is the call graph for this function:

◆ unregister()

MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::unregister ( string $key)

Removes the given ZType from the type cache, except for builtin types.

Parameters
string$key

Reimplemented from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry.

Member Data Documentation

◆ BUILT_IN_TYPE_FUNCTIONS

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::BUILT_IN_TYPE_FUNCTIONS
Initial value:
= [
self::Z_FUNCTION_TYPED_LIST => 'ZTypedList',
self::Z_FUNCTION_TYPED_PAIR => 'ZTypedPair',
self::Z_FUNCTION_TYPED_MAP => 'ZTypedMap',
self::Z_FUNCTION_ERRORTYPE_TO_TYPE => 'ZTypedError'
]

◆ DISALLOWED_ROOT_ZOBJECTS

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::DISALLOWED_ROOT_ZOBJECTS
Initial value:
= [
self::Z_PERSISTENTOBJECT,
self::Z_KEY,
self::Z_REFERENCE,
self::Z_ARGUMENTDECLARATION,
self::Z_ARGUMENTREFERENCE,
self::Z_KEYREFERENCE,
self::Z_ERROR,
self::Z_CODE,
]

An array of ZTypes which are prohibited from creation by any user.

(T278175)

◆ IGNORE_KEY_NORMALIZATION

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::IGNORE_KEY_NORMALIZATION
Initial value:
= [
self::Z_OBJECT_TYPE,
self::Z_MONOLINGUALSTRING_LANGUAGE,
self::Z_MONOLINGUALSTRING_VALUE,
self::Z_MULTILINGUALSTRING_VALUE
]

◆ IGNORE_KEY_VALUES_FOR_LABELLING

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::IGNORE_KEY_VALUES_FOR_LABELLING
Initial value:
= [
self::Z_QUOTE_VALUE,
self::Z_KEYREFERENCE_VALUE,
self::Z_KEY_ID,
self::Z_PERSISTENTOBJECT_ID,
self::Z_TYPE_IDENTITY,
]

◆ SELF_REFERENTIAL_KEYS

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::SELF_REFERENTIAL_KEYS
Initial value:
= [
self::Z_TYPE_IDENTITY,
self::Z_PERSISTENTOBJECT_ID,
self::Z_FUNCTION_IDENTITY
]

◆ TERMINAL_KEYS

const MediaWiki\Extension\WikiLambda\Registry\ZTypeRegistry::TERMINAL_KEYS
Initial value:
= [
self::Z_STRING_VALUE,
self::Z_REFERENCE_VALUE
]

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