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

 Methods

__construct()

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

Parameters

$class

stringnull

$alias

stringnull

$constructor

mixed

$params

array

Add a method called on the instance

addMethod($method) : \Zend\Di\ServiceLocator\GeneratorInstance

Parameters

$method

Returns

Alias for the instance (if any)

getAlias() : string | null

Returns

stringnull

Class of the instance.

getClass() : string | null

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

Returns

stringnull

Get instantiator

getConstructor() : mixed

Returns

mixedconstructor method name or callable responsible for generating instance

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

getMethods() : array

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

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

getName() : string | null

Returns

stringnull

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

getParams() : array

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

Returns

array

Retrieves whether the instance is shared or not

isShared() : bool

Returns

bool

Set instance alias

setAlias(string $alias) : \Zend\Di\ServiceLocator\GeneratorInstance

Parameters

$alias

string

Returns

Set class name

setClass(string $class) : \Zend\Di\ServiceLocator\GeneratorInstance

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

Parameters

$class

string

Returns

Set methods

setMethods(array $methods) : \Zend\Di\ServiceLocator\GeneratorInstance

Parameters

$methods

array

Returns

setShared()

setShared(bool $shared) 

Parameters

$shared

bool

 Properties

 

$alias

$alias : string | null

 

$class

$class : string | null

 

$constructor

$constructor : mixed

 

$methods

$methods : array

 

$params

$params : array

 

$shared

$shared : bool