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

Container for methods and parameters used by Di to create a particular instance. More...

Public Member Functions

 __construct ($class, $alias, $constructor, array $params)
 
 getName ()
 Retrieves the best available name for this instance (instance alias first then class name)
 
 getClass ()
 Class of the instance.
 
 getAlias ()
 Alias for the instance (if any)
 
 setClass ($class)
 Set class name.
 
 setAlias ($alias)
 Set instance alias.
 
 getConstructor ()
 Get instantiator.
 
 getParams ()
 Parameters passed to the instantiator as an ordered list of parameters.
 
 setMethods (array $methods)
 Set methods.
 
 addMethod ($method)
 Add a method called on the instance.
 
 getMethods ()
 Retrieves a list of methods that are called on the instance in their call order.
 
 setShared ($shared)
 
 isShared ()
 Retrieves whether the instance is shared or not.
 

Protected Attributes

 $class
 
 $alias
 
 $constructor
 
 $params
 
 $methods = []
 
 $shared = true
 

Detailed Description

Container for methods and parameters used by Di to create a particular instance.

Constructor & Destructor Documentation

__construct (   $class,
  $alias,
  $constructor,
array  $params 
)
Parameters
string | null$class
string | null$alias
mixed$constructor
array$params

Member Function Documentation

addMethod (   $method)

Add a method called on the instance.

Parameters
$method
Returns
GeneratorInstance
getAlias ( )

Alias for the instance (if any)

Returns
string|null
getClass ( )

Class of the instance.

Null if class is unclear (such as when the instance is produced by a callback)

Returns
string|null
getConstructor ( )

Get instantiator.

Returns
mixed constructor method name or callable responsible for generating instance
getMethods ( )

Retrieves a list of methods that are called on the instance in their call order.

Each returned element has form array('method' => 'methodName', 'params' => array( ... ordered list of call parameters ... ), where every call parameter that is a recursively fetched instance is a GeneratorInstance itself

Returns
array
getName ( )

Retrieves the best available name for this instance (instance alias first then class name)

Returns
string|null
getParams ( )

Parameters passed to the instantiator as an ordered list of parameters.

Each parameter that refers to another instance fetched recursively is a GeneratorInstance itself

Returns
array
isShared ( )

Retrieves whether the instance is shared or not.

Returns
bool
setAlias (   $alias)

Set instance alias.

Parameters
string$alias
Returns
GeneratorInstance
setClass (   $class)

Set class name.

In the case of an instance created via a callback, we need to set the class name after creating the generator instance.

Parameters
string$class
Returns
GeneratorInstance
setMethods ( array  $methods)

Set methods.

Parameters
array$methods
Returns
GeneratorInstance
setShared (   $shared)
Parameters
bool$shared

Member Data Documentation

$alias
protected
$class
protected
$constructor
protected
$methods = []
protected
$params
protected
$shared = true
protected