Dependency injector that can generate instances using class definitions and configured instance parameters

package Zend_Di

 Methods

Constructor

__construct(\Zend\Di\Di $di, \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator, \Zend\ServiceManager\Di\DiInstanceManagerProxy $diImProxy) 

Provide a configuration object to configure this instance

configure(\Zend\Di\Config $config) : void
Inherited

inherited_from \Zend\Di\Di::configure()

Parameters

$config

\Zend\Di\Config

definitions()

definitions() : \Zend\Di\DefinitionList
Inherited

inherited_from \Zend\Di\Di::definitions()

Returns

Lazy-load a class

get(string $name, array $params) : object | null
Inherited

Attempts to load the class (or service alias) provided. If it has been loaded before, the previous instance will be returned (unless the service definition indicates shared instances should not be used).

inherited_from \Zend\Di\Di::get()

Parameters

$name

string

Class name or service alias

$params

nullarray

Parameters to pass to the constructor

Returns

objectnull

Initialize

initialize($instance, \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) : mixed

Parameters

$instance

Exceptions

\Exception

Returns

mixed

Inject dependencies

injectDependencies(object $instance, array $params) : void
Inherited

inherited_from \Zend\Di\Di::injectDependencies()

Parameters

$instance

object

$params

array

instanceManager()

instanceManager() : \Zend\Di\InstanceManager
Inherited

inherited_from \Zend\Di\Di::instanceManager()

Returns

Retrieve a new instance of a class

newInstance(mixed $name, array $params, bool $isShared) : object | null
Inherited

Forces retrieval of a discrete instance of the given class, using the constructor parameters provided.

inherited_from \Zend\Di\Di::newInstance()

Parameters

$name

mixed

Class name or service alias

$params

array

Parameters to pass to the constructor

$isShared

bool

Exceptions

\Zend\Di\Exception\ClassNotFoundException
\Zend\Di\Exception\RuntimeException

Returns

objectnull

setDefinitionList()

setDefinitionList(\Zend\Di\DefinitionList $definitions) : \Zend\Di\self
Inherited

inherited_from \Zend\Di\Di::setDefinitionList()

Parameters

Returns

\Zend\Di\self

Set the instance manager

setInstanceManager(\Zend\Di\InstanceManager $instanceManager) : \Zend\Di\Di
Inherited

inherited_from \Zend\Di\Di::setInstanceManager()

Parameters

$instanceManager

\Zend\Di\InstanceManager

Returns

Get an object instance from the defined callback

createInstanceViaCallback(\Zend\Di\callable $callback, array $params, string $alias) : object
Inherited

inherited_from \Zend\Di\Di::createInstanceViaCallback()

Parameters

$callback

\Zend\Di\callable

$params

array

$alias

string

Exceptions

\Zend\Di\Exception\InvalidCallbackException
\Zend\Di\Exception\RuntimeException

Returns

object

Retrieve a class instance based on class name

createInstanceViaConstructor(string $class, array $params, string | null $alias) : object
Inherited

Any parameters provided will be used as constructor arguments. If any given parameter is a DependencyReference object, it will be fetched from the container so that the instance may be injected.

inherited_from \Zend\Di\Di::createInstanceViaConstructor()

Parameters

$class

string

$params

array

$alias

stringnull

Returns

object

getCallParameters()

getCallParameters($name, array $params, string $method) : array
Inherited

inherited_from \Zend\Di\Di::getCallParameters()

Parameters

$name

$params

array

$method

string

Returns

array

handleInjectDependencies()

handleInjectDependencies(object $instance, array $injectionMethods, array $params, string | null $instanceClass, $instanceAlias, string $requestedName) 
Inherited

inherited_from \Zend\Di\Di::handleInjectDependencies()

Parameters

$instance

object

$injectionMethods

array

$params

array

$instanceClass

stringnull

$instanceAlias

string|null$instanceAlias

$requestedName

string

Exceptions

\Zend\Di\Exception\RuntimeException

Checks if the object has this class as one of its parents

isSubclassOf(string $className, $type) : bool
Inherited

see \Zend\Di\https://bugs.php.net/bug.php?id=53727
see \Zend\Di\https://github.com/zendframework/zf2/pull/1807
inherited_from \Zend\Di\Di::isSubclassOf()

Parameters

$className

string

$type

Returns

bool

This parameter will handle any injection methods and resolution of dependencies for such methods

resolveAndCallInjectionMethodForInstance(object $instance, string $method, array $params, string $alias, bool $methodIsRequired, string | null $methodClass) : bool
Inherited

inherited_from \Zend\Di\Di::resolveAndCallInjectionMethodForInstance()

Parameters

$instance

object

$method

string

$params

array

$alias

string

$methodIsRequired

bool

$methodClass

stringnull

Returns

bool

Resolve parameters referencing other services

resolveMethodParameters(string $class, string $method, array $callTimeUserParams, string $alias, bool $methodIsRequired, bool $isInstantiator) : array
Inherited

inherited_from \Zend\Di\Di::resolveMethodParameters()

Parameters

$class

string

$method

string

$callTimeUserParams

array

$alias

string

$methodIsRequired

bool

$isInstantiator

bool

Exceptions

\Zend\Di\Exception\MissingPropertyException
\Zend\Di\Exception\CircularDependencyException

Returns

array

 Properties

 

All the class dependencies [source][dependency]

$currentDependencies : array
Inherited

inherited_from \Zend\Di\Di::$$currentDependencies
 

$definitions

$definitions : \Zend\Di\DefinitionList
Inherited

inherited_from \Zend\Di\Di::$$definitions
 

$di

$di : \Zend\Di\Di

 

$diInstanceManagerProxy

$diInstanceManagerProxy : \Zend\ServiceManager\Di\DiInstanceManagerProxy

 

$instanceContext

$instanceContext : string
Inherited

inherited_from \Zend\Di\Di::$$instanceContext
 

$instanceManager

$instanceManager : \Zend\Di\InstanceManager
Inherited

inherited_from \Zend\Di\Di::$$instanceManager
 

All the class references [dependency][source]

$references : array
Inherited

inherited_from \Zend\Di\Di::$$references
 

$serviceLocator

$serviceLocator : \Zend\ServiceManager\ServiceLocatorInterface