di\Container resolveCallableDependencies()

resolveCallableDependencies() public method (available since version 2.0.7) Resolve dependencies for a function. This method can be used to implement similar functionality as provided by invoke() in other components. public array resolveCallableDependencies ( callable $callback, $params = [] )$callback callable Callable to be invoked. $params array The array of parameters for the function, can be either numeric or associative. return array The resolved dependencies. throws yii\base\

di\Container normalizeDefinition()

normalizeDefinition() protected method Normalizes the class definition. protected array normalizeDefinition ( $class, $definition )$class string Class name $definition string|array|callable The class definition return array The normalized class definition throws yii\base\InvalidConfigException if the definition is invalid.

di\Container mergeParams()

mergeParams() protected method Merges the user-specified constructor parameters with the ones registered via set(). protected array mergeParams ( $class, $params )$class string Class name, interface name or alias name $params array The constructor parameters return array The merged parameters

di\Container invoke()

invoke() public method (available since version 2.0.7) Invoke a callback with resolving dependencies in parameters. This methods allows invoking a callback and let type hinted parameter names to be resolved as objects of the Container. It additionally allow calling function using named parameters. For example, the following callback may be invoked using the Container to resolve the formatter dependency: $formatString = function($string, \yii\i18n\Formatter $formatter) { // ... } Yii::$co

di\Container hasSingleton()

hasSingleton() public method Returns a value indicating whether the given name corresponds to a registered singleton. public boolean hasSingleton ( $class, $checkInstance = false )$class string Class name, interface name or alias name $checkInstance boolean Whether to check if the singleton has been instantiated. return boolean Whether the given name corresponds to a registered singleton. If $checkInstance is true, the method should return a value indicating whether the singleton has

di\Container has()

has() public method Returns a value indicating whether the container has the definition of the specified name. See also set(). public boolean has ( $class )$class string Class name, interface name or alias name return boolean Whether the container has the definition of the specified name..

di\Container getDependencies()

getDependencies() protected method Returns the dependencies of the specified class. protected array getDependencies ( $class )$class string Class name, interface name or alias name return array The dependencies of the specified class.

di\Container getDefinitions()

getDefinitions() public method Returns the list of the object definitions or the loaded shared objects. public array getDefinitions ( )return array The list of the object definitions or the loaded shared objects (type or ID => definition or instance).

di\Container get()

get() public method Returns an instance of the requested class. You may provide constructor parameters ($params) and object configurations ($config) that will be used during the creation of the instance. If the class implements yii\base\Configurable, the $config parameter will be passed as the last parameter to the class constructor; Otherwise, the configuration will be applied after the object is instantiated. Note that if the class is declared to be singleton by calling setSingleton(), th

di\Container clear()

clear() public method Removes the definition for the specified name. public void clear ( $class )$class string Class name, interface name or alias name