libSmalldb  v2.0.2
Public Member Functions | List of all members
ExtensibleDefinition Class Reference

Inheritance diagram for ExtensibleDefinition

Public Member Functions

 __construct (array $extensions)
 ExtensibleDefinition constructor. More...
 
 hasExtension (string $extensionClassName)
 Return true if an extension of given type is defined for this element. More...
 
 getExtension (string $extensionClassName)
 Get an extension of given type. More...
 
 findExtension (string $extensionClassName)
 Get an extension of given type. More...
 
 getExtensionClassNames ()
 Get a list of existing extensions. More...
 
 jsonSerialize ()
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( array  $extensions)

ExtensibleDefinition constructor.

Note: $extensions is an array of objects indexed by their respective class names.

Parameters
ExtensionInterface[]$extensions

Member Function Documentation

◆ hasExtension()

hasExtension ( string  $extensionClassName)

Return true if an extension of given type is defined for this element.

◆ getExtension()

getExtension ( string  $extensionClassName)

Get an extension of given type.

Throws UndefinedExtensionException if the extension is not found.

It would be nice to write getExtension<T>(): T ...

ExtensionInterface

Parameters
class-string<ExtensionInterface>$extensionClassName
Returns
ExtensionInterface

◆ findExtension()

findExtension ( string  $extensionClassName)

Get an extension of given type.

Just like getExtension(), but returns null if the extension is not found.

It would be nice to write getExtension<T>(): T ...

ExtensionInterface

Parameters
class-string<ExtensionInterface>$extensionClassName
Returns
ExtensionInterface

◆ getExtensionClassNames()

getExtensionClassNames ( )

Get a list of existing extensions.

Returns
string[]

◆ jsonSerialize()

jsonSerialize ( )