Joomla\DI\Container
The Container class.
Synopsis
class Container
{
- // members
- protected $aliases;
- protected $instances;
- protected $dataStore;
- protected Container $parent;
- // methods
- public void __construct()
- public Container alias()
- protected string resolveAlias()
- public mixed buildObject()
- public buildSharedObject()
- public Container createChild()
- public void extend()
- protected array getMethodArgs()
- public Container set()
- public Container protect()
- public Container share()
- public mixed get()
- protected mixed getRaw()
- public mixed getNewInstance()
- public Container registerServiceProvider()
Members
protected
- $aliases
—
array
Holds the key aliases. - $dataStore
—
array
Holds the keys, their callbacks, and whether or not the item is meant to be a shared resource. - $instances
—
array
Holds the shared instances. - $parent
—
Joomla\DI\Container
Parent for hierarchical containers.
Methods
protected
- getMethodArgs() — Build an array of constructor parameters.
- getRaw() — Get the raw data assigned to a key.
- resolveAlias() — Search the aliases property for a matching alias key.
public
- __construct() — Constructor for the DI Container
- alias() — Create an alias for a given key for easy access.
- buildObject() — Build an object of class $key;
- createChild() — Create a child Container with a new property scope that that has the ability to access the parent scope when resolving.
- extend() — Extend a defined service Closure by wrapping the existing one with a new Closure. This works very similar to a decorator pattern. Note that this only works on service Closures that have been defined in the current Provider, not parent providers.
- get() — Method to retrieve the results of running the $callback for the specified $key;
- getNewInstance() — Method to force the container to return a new instance of the results of the callback for requested $key.
- protect() — Convenience method for creating protected keys.
- registerServiceProvider() — Register a service provider to the container.
- set() — Method to set the key and callback to the dataStore array.