Container
class Container implements ArrayAccess, IteratorAggregate, Countable (View source)
The DI Container.
Constants
FORCE_NEW |
|
Methods
bindShared
prepareObject
prepareSharedObject
createObject
createSharedObject
Create an object of class $key;
Execute a callable with dependencies.
whenCreating
Create a child Container with a new property scope that that has the ability to access the parent scope when resolving.
Method to set the key and callback to the dataStore array.
Convenience method for creating protected keys.
Convenience method for creating shared keys.
Method to retrieve the results of running the $callback for the specified $key;
Method to check if specified dataStore key exists.
Method to force the container to return a new instance of the results of the callback for requested $key.
Fork an instance to a new key.
Register a service provider to the container.
hasChild
removeChild
Method to get property Children
Method to set property children
Retrieve an external iterator
Is a property exists or not.
Get a property.
Set a value to property.
Unset a property.
Count this object.
Details
at line line 71
__construct(Container $parent = null, array $children = array())
Constructor for the DI Container
at line line 87
Container
alias(string $alias, string $key)
Create an alias for a given key for easy access.
at line line 125
Container
bind(string $name, mixed $value, bool $shared = false, bool $protected = false)
bind
at line line 149
Container
bindShared(string $name, mixed $value, bool $protected = false)
bindShared
at line line 166
Container
prepareObject(string $class, callable $extend = null, bool $shared = false, bool $protected = false)
prepareObject
at line line 194
Container
prepareSharedObject(string $class, callable $extend = null, bool $protected = false)
prepareSharedObject
at line line 210
object
createObject(string $class, array $args = array(), bool $shared = false, bool $protected = false)
createObject
at line line 231
object
createSharedObject(string $class, array $args = array(), bool $protected = false)
createSharedObject
at line line 248
mixed
newInstance(string $class, array $args = array())
Create an object of class $key;
at line line 388
mixed
execute(callable $callable, array $args = array())
Execute a callable with dependencies.
at line line 454
Container
createChild(string $name = null)
Create a child Container with a new property scope that that has the ability to access the parent scope when resolving.
at line line 476
Container
extend(string $key, Closure $callable)
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.
at line line 514
Container
set(string $key, mixed $value, boolean $shared = false, boolean $protected = false)
Method to set the key and callback to the dataStore array.
at line line 537
Container
protect(string $key, callable $callback, bool $shared = false)
Convenience method for creating protected keys.
at line line 553
Container
share(string $key, callable|mixed $callback, bool $protected = false)
Convenience method for creating shared keys.
at line line 569
mixed
get(string $key, boolean $forceNew = false)
Method to retrieve the results of running the $callback for the specified $key;
at line line 611
boolean
exists(string $key)
Method to check if specified dataStore key exists.
at line line 651
mixed
getNewInstance(string $key)
Method to force the container to return a new instance of the results of the callback for requested $key.
at line line 667
mixed
fork(string $key, string $newKey, bool $forceNew = false)
Fork an instance to a new key.
at line line 685
Container
registerServiceProvider(ServiceProviderInterface $provider)
Register a service provider to the container.
at line line 766
boolean
hasChild(string $name)
hasChild
at line line 825
Traversable
getIterator()
Retrieve an external iterator
at line line 839
boolean
offsetExists(mixed $offset)
Is a property exists or not.
at line line 853
mixed
offsetGet(mixed $offset)
Get a property.
at line line 868
void
offsetSet(mixed $offset, mixed $value)
Set a value to property.
at line line 882
void
offsetUnset(mixed $offset)
Unset a property.
at line line 894
integer
count()
Count this object.