Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PrototypeClassFactory Class Reference

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

Public Member Functions

 __construct ($prototypes=[], PrototypeGenericInterface $genericPrototype=null)
 
 addPrototype (PrototypeInterface $prototype)
 
 setGenericPrototype (PrototypeGenericInterface $prototype)
 
 hasPrototype ($name)
 
 getClonedPrototype ($prototypeName)
 

Protected Member Functions

 normalizeName ($name)
 

Protected Attributes

 $prototypes = []
 
 $genericPrototype = null
 

Detailed Description

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.

Constructor & Destructor Documentation

__construct (   $prototypes = [],
PrototypeGenericInterface  $genericPrototype = null 
)
Parameters
PrototypeInterface[]$prototypes
PrototypeGenericInterface$genericPrototype

Member Function Documentation

addPrototype ( PrototypeInterface  $prototype)
Parameters
PrototypeInterface$prototype
Exceptions
Exception\InvalidArgumentException
getClonedPrototype (   $prototypeName)
Parameters
string$prototypeName
Returns
PrototypeInterface
Exceptions
Exception\RuntimeException
hasPrototype (   $name)
Parameters
string$name
Returns
bool
normalizeName (   $name)
protected
Parameters
string$name
Returns
string
setGenericPrototype ( PrototypeGenericInterface  $prototype)
Parameters
PrototypeGenericInterface$prototype
Exceptions
Exception\InvalidArgumentException

Member Data Documentation

$genericPrototype = null
protected
$prototypes = []
protected