|
| | __construct (ContainerInterface $parent=null) |
| |
| | alias ($alias, $key) |
| |
| | tag ($tag, array $keys) |
| |
| | getTagged ($tag) |
| |
| | buildObject ($key, $shared=false) |
| |
| | buildSharedObject ($key) |
| |
| | createChild () |
| |
| | extend ($key, \Closure $callable) |
| |
| | set ($key, $value, $shared=false, $protected=false) |
| |
| | protect ($key, $value, $shared=false) |
| |
| | share ($key, $value, $protected=false) |
| |
| | get ($key, $forceNew=false) |
| |
| | has ($key) |
| |
| | exists ($key) |
| |
| | getNewInstance ($key) |
| |
| | registerServiceProvider (ServiceProviderInterface $provider) |
| |
| | getKeys () |
| |
| | get ($id) |
| |
The Container class.
- Depuis
- 1.0
◆ __construct()
◆ alias()
Create an alias for a given key for easy access.
- Paramètres
-
| string | $alias | The alias name |
| string | $key | The key to alias |
- Renvoie
- Container This object for chaining.
- Depuis
- 1.0
Références $key.
◆ buildObject()
| buildObject |
( |
|
$key, |
|
|
|
$shared = false |
|
) |
| |
◆ buildSharedObject()
| buildSharedObject |
( |
|
$key | ) |
|
Convenience method for building a shared object.
- Paramètres
-
| string | $key | The class name to build. |
- Renvoie
- object|false Instance of class specified by $key with all dependencies injected. Returns an object if the class exists and false otherwise
- Depuis
- 1.0
Références $key, et Container\buildObject().
◆ createChild()
Create a child Container with a new property scope that that has the ability to access the parent scope when resolving.
- Renvoie
- Container This object for chaining.
- Depuis
- 1.0
◆ exists()
◆ extend()
| extend |
( |
|
$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.
- Paramètres
-
| string | $key | The unique identifier for the Closure or property. |
| \Closure | $callable | A Closure to wrap the original service Closure. |
- Renvoie
- void
- Depuis
- 1.0
- Exceptions
-
Références $key, Container\getRaw(), null, et Container\resolveAlias().
◆ get()
| get |
( |
|
$key, |
|
|
|
$forceNew = false |
|
) |
| |
Method to retrieve the results of running the $callback for the specified $key;
- Paramètres
-
| string | $key | Name of the dataStore key to get. |
| boolean | $forceNew | True to force creation and return of a new instance. |
- Renvoie
- mixed Results of running the $callback for the specified $key.
- Depuis
- 1.0
- Exceptions
-
Références $key, Container\getRaw(), null, et Container\resolveAlias().
◆ getKeys()
Retrieve the keys for services assigned to this container.
- Renvoie
- array
- Depuis
- 1.5.0
◆ getMethodArgs()
| getMethodArgs |
( |
\ReflectionMethod |
$method | ) |
|
|
protected |
◆ getNewInstance()
Method to force the container to return a new instance of the results of the callback for requested $key.
- Paramètres
-
| string | $key | Name of the dataStore key to get. |
- Renvoie
- mixed Results of running the $callback for the specified $key.
- Depuis
- 1.0
Références $key.
◆ getRaw()
◆ getTagged()
Fetch all services registered to the given tag.
- Paramètres
-
- Renvoie
- array The resolved services for the given tag
- Depuis
- 1.5.0
◆ has()
◆ protect()
| protect |
( |
|
$key, |
|
|
|
$value, |
|
|
|
$shared = false |
|
) |
| |
Convenience method for creating protected keys.
- Paramètres
-
| string | $key | Name of dataStore key to set. |
| mixed | $value | Callable function to run or string to retrive when requesting the specified $key. |
| boolean | $shared | True to create and store a shared instance. |
- Renvoie
- Container This object for chaining.
- Depuis
- 1.0
Références $key, et $value.
◆ registerServiceProvider()
◆ resolveAlias()
◆ set()
| set |
( |
|
$key, |
|
|
|
$value, |
|
|
|
$shared = false, |
|
|
|
$protected = false |
|
) |
| |
Method to set the key and callback to the dataStore array.
- Paramètres
-
| string | $key | Name of dataStore key to set. |
| mixed | $value | Callable function to run or string to retrive when requesting the specified $key. |
| boolean | $shared | True to create and store a shared instance. |
| boolean | $protected | True to protect this item from being overwritten. Useful for services. |
- Renvoie
- Container This object for chaining.
- Depuis
- 1.0
- Exceptions
-
| ProtectedKeyException | Thrown if the provided key is already set and is protected. |
Références $key, et $value.
◆ share()
| share |
( |
|
$key, |
|
|
|
$value, |
|
|
|
$protected = false |
|
) |
| |
Convenience method for creating shared keys.
- Paramètres
-
| string | $key | Name of dataStore key to set. |
| mixed | $value | Callable function to run or string to retrive when requesting the specified $key. |
| boolean | $protected | True to protect this item from being overwritten. Useful for services. |
- Renvoie
- Container This object for chaining.
- Depuis
- 1.0
Références $key, et $value.
◆ tag()
| tag |
( |
|
$tag, |
|
|
array |
$keys |
|
) |
| |
Assign a tag to services.
- Paramètres
-
| string | $tag | The tag name |
| array | $keys | The service keys to tag |
- Renvoie
- Container This object for chaining.
- Depuis
- 1.5.0
Références $key, et Container\resolveAlias().
◆ $aliases
◆ $dataStore
◆ $instances
◆ $parent
◆ $tags
La documentation de cette classe a été générée à partir du fichier suivant :