Registry of instantiated objects, their names and the parameters used to build them

category Zend
package Zend_Di

 Methods

Add alias

addAlias(string $alias, string $class, array $parameters) : void

Parameters

$alias

string

$class

string

$parameters

array

Exceptions

\Zend\Di\Exception\InvalidArgumentException

Add shared instance

addSharedInstance(object $instance, string $classOrAlias) 

Parameters

$instance

object

$classOrAlias

string

Exceptions

\Zend\Di\Exception\InvalidArgumentException

addSharedInstanceWithParameters()

addSharedInstanceWithParameters(object $instance, string $classOrAlias, array $params) : void

Parameters

$instance

object

$classOrAlias

string

$params

array

Adds a type preference.

addTypePreference(string $interfaceOrAbstract, string $preferredImplementation) : \Zend\Di\self

A type preference is a redirection to a preferred alias or type when an abstract type $interfaceOrAbstract is requested

Parameters

$interfaceOrAbstract

string

$preferredImplementation

string

Returns

\Zend\Di\self

Get aliases

getAliases() : array

Returns

array

getClassFromAlias()

getClassFromAlias($alias) : string | bool

Parameters

$alias

string

Exceptions

\Zend\Di\Exception\RuntimeException

Returns

stringbool

Get classes

getClasses() : array

Returns

array

getConfig()

getConfig(string $aliasOrClass) : array

Parameters

$aliasOrClass

string

Returns

array

getSharedInstance()

getSharedInstance($classOrAlias) 

Parameters

$classOrAlias

Retrieves an instance by its name and the parameters stored at its instantiation

getSharedInstanceWithParameters(string $classOrAlias, array $params, bool | null $fastHashFromHasLookup) : object | bool

Parameters

$classOrAlias

string

$params

array

$fastHashFromHasLookup

boolnull

Returns

objectboolfalse if no instance was found

Get type preferences

getTypePreferences(string $interfaceOrAbstract) : array

Parameters

$interfaceOrAbstract

string

Returns

array

Check for an alias

hasAlias(string $alias) : bool

Parameters

$alias

string

Returns

bool

Check for configuration

hasConfig(string $aliasOrClass) : bool

Parameters

$aliasOrClass

string

Returns

bool

Does this instance manager have this shared instance

hasSharedInstance(string $classOrAlias) : bool

Parameters

$classOrAlias

string

Returns

bool

hasSharedInstanceWithParameters()

hasSharedInstanceWithParameters(string $classOrAlias, array $params, bool $returnFastHashLookupKey) : bool | string

Parameters

$classOrAlias

string

$params

array

$returnFastHashLookupKey

bool

Returns

boolstring

Check for type preferences

hasTypePreferences(string $interfaceOrAbstract) : bool

Parameters

$interfaceOrAbstract

string

Returns

bool

Removes a previously set type preference

removeTypePreference(string $interfaceOrAbstract, string $preferredType) : bool | \Zend\Di\self

Parameters

$interfaceOrAbstract

string

$preferredType

string

Returns

bool\Zend\Di\self

Sets configuration for a single alias/class

setConfig(string $aliasOrClass, array $configuration, bool $append) 

Parameters

$aliasOrClass

string

$configuration

array

$append

bool

setInjections() is a convenience method for: setConfig($type, array('injections' => array(.

setInjections(string $aliasOrClass, array $injections) : void

..)), true);

Parameters

$aliasOrClass

string

Alias or Class

$injections

array

Multi-dim array of methods and their parameters

setParameters() is a convenience method for: setConfig($type, array('parameters' => array(.

setParameters(string $aliasOrClass, array $parameters) : void

..)), true);

Parameters

$aliasOrClass

string

Alias or Class

$parameters

array

Multi-dim array of parameters and their values

Set shared

setShared(string $aliasOrClass, bool $isShared) : void

Parameters

$aliasOrClass

string

$isShared

bool

Set type preference

setTypePreference(string $interfaceOrAbstract, array $preferredImplementations) : \Zend\Di\InstanceManager

Parameters

$interfaceOrAbstract

string

$preferredImplementations

array

Returns

Unset type preferences

unsetTypePreferences(string $interfaceOrAbstract) : void

Parameters

$interfaceOrAbstract

string

createHashForKeys()

createHashForKeys(string $classOrAlias, string[] $paramKeys) : string

Parameters

$classOrAlias

string

$paramKeys

string[]

Returns

string

createHashForValues()

createHashForValues(string $classOrAlias, array $paramValues) : string

Parameters

$classOrAlias

string

$paramValues

array

Returns

string

getBaseAlias()

getBaseAlias(string $alias) : string | bool

Parameters

$alias

string

Exceptions

\Zend\Di\Exception\RuntimeException

Returns

stringbool

 Properties

 

Array of class aliases

$aliases : array

 

The template to use for housing configuration information

$configurationTemplate : array

 

An array of instance configuration data

$configurations : array

 

Array of shared instances

$sharedInstances : array

 

Array of shared instances with params

$sharedInstancesWithParams : array

 

An array of globally preferred implementations for interfaces/abstracts

$typePreferences : array