This is a factory for classes which are identified by name.

All classes that this factory can supply need to be registered before (prototypes). This prototypes need to implement an interface which ensures every prototype has a name.

If the factory can not supply the class someone is asking for it tries to fallback on a generic default prototype, which would have need to be set before.

package Default

 Methods

__construct()

__construct(array<mixed,\Zend\Code\Generic\Prototype\PrototypeInterface> $prototypes = array(), \Zend\Code\Generic\Prototype\PrototypeGenericInterface $genericPrototype = null

Parameters

$prototypes

array<mixed,\Zend\Code\Generic\Prototype\PrototypeInterface>

$genericPrototype

\Zend\Code\Generic\Prototype\PrototypeGenericInterface

addPrototype()

addPrototype(\Zend\Code\Generic\Prototype\PrototypeInterface $prototype) 

Parameters

$prototype

\Zend\Code\Generic\Prototype\PrototypeInterface

Exceptions

\Zend\Code\Reflection\Exception\InvalidArgumentException

getClonedPrototype()

getClonedPrototype(string $prototypeName) : \Zend\Code\Generic\Prototype\PrototypeInterface

Parameters

$prototypeName

string

Exceptions

\Zend\Code\Reflection\Exception\RuntimeException

Returns

\Zend\Code\Generic\Prototype\PrototypeInterface

hasPrototype()

hasPrototype(string $name) : boolean

Parameters

$name

string

Returns

boolean

setGenericPrototype()

setGenericPrototype(\Zend\Code\Generic\Prototype\PrototypeGenericInterface $prototype) 

Parameters

$prototype

\Zend\Code\Generic\Prototype\PrototypeGenericInterface

Exceptions

\Zend\Code\Reflection\Exception\InvalidArgumentException

normalizeName()

normalizeName(string $name) : string

Parameters

$name

string

Returns

string

 Properties

 

$genericPrototype

$genericPrototype : \Zend\Code\Generic\Prototype\PrototypeGenericInterface

Default

null
 

$prototypes

$prototypes : array

Default

array()