|
| call ($callable, array $parameters=[]) |
| Call the given function using the given parameters.
|
|
| debugEntry (string $name) |
| Get entry debug information.
|
|
| get (string $id) |
| Returns an entry of the container by its name.
|
|
| getKnownEntryNames () |
| Get defined container entries.
|
|
| has (string $id) |
| Returns true if the container can return an entry for the given identifier.
|
|
| injectOn (object $instance) |
| Inject all dependencies on an existing instance.
|
|
| make (string $name, array $parameters=[]) |
| Build an entry of the container by its name.
|
|
| set (string $name, mixed $value) |
| Define an object or a value in the container.
|
|
|
static | create (array $definitions) |
|
|
| resolveFactory ($callable, $entryName, array $extraParameters=[]) |
| Invoke the given callable.
|
|
| setDefinition (string $name, Definition $definition) |
|
◆ call()
DI\Container::call |
( |
| $callable, |
|
|
array | $parameters = [] ) |
|
inherited |
Call the given function using the given parameters.
Missing parameters will be resolved from the container.
- Parameters
-
callable | array | string | $callable | Function to call. |
array | $parameters | Parameters to use. Can be indexed by the parameter names or not indexed (same order as the parameters). The array can also contain DI definitions, e.g. DI\get(). |
- Return values
-
mixed | Result of the function. |
Implements Invoker\InvokerInterface.
◆ debugEntry()
DI\Container::debugEntry |
( |
string | $name | ) |
|
|
inherited |
Get entry debug information.
- Parameters
-
- Exceptions
-
InvalidDefinition | |
NotFoundException | |
◆ get()
DI\CompiledContainer::get |
( |
string | $id | ) |
|
Returns an entry of the container by its name.
@template T
- Parameters
-
string|class-string<T> | $id Entry name or a class name. |
- Return values
-
- Exceptions
-
DependencyException | Error while resolving the entry. |
NotFoundException | No entry found for the given name. |
Reimplemented from DI\Container.
◆ getKnownEntryNames()
DI\Container::getKnownEntryNames |
( |
| ) |
|
|
inherited |
Get defined container entries.
- Return values
-
◆ has()
DI\CompiledContainer::has |
( |
string | $id | ) |
|
Returns true if the container can return an entry for the given identifier.
Returns false otherwise.
has($id)
returning true does not mean that get($id)
will not throw an exception. It does however mean that get($id)
will not throw a NotFoundExceptionInterface
.
- Parameters
-
string | $id | Identifier of the entry to look for. |
- Return values
-
Reimplemented from DI\Container.
◆ injectOn()
DI\Container::injectOn |
( |
object | $instance | ) |
|
|
inherited |
Inject all dependencies on an existing instance.
@template T
- Parameters
-
object | T | $instance | Object to perform injection upon |
- Return values
-
object|T\$instance | Returns the same instance |
- Exceptions
-
InvalidArgumentException | |
DependencyException | Error while injecting dependencies |
◆ make()
DI\Container::make |
( |
string | $name, |
|
|
array | $parameters = [] ) |
|
inherited |
Build an entry of the container by its name.
This method behave like get() except resolves the entry again every time. For example if the entry is a class then a new instance will be created each time.
This method makes the container behave like a factory.
@template T
- Parameters
-
| string|class-string<T> | $name Entry name or a class name. |
array | $parameters | Optional parameters to use to build the entry. Use this to force specific parameters to specific values. Parameters not defined in this array will be resolved using the container. |
- Return values
-
- Exceptions
-
InvalidArgumentException | The name parameter must be of type string. |
DependencyException | Error while resolving the entry. |
NotFoundException | No entry found for the given name. |
Implements DI\FactoryInterface.
◆ set()
DI\Container::set |
( |
string | $name, |
|
|
mixed | $value ) |
|
inherited |
Define an object or a value in the container.
- Parameters
-
string | $name | Entry name |
mixed | DefinitionHelper | $value | Value, use definition helpers to define objects |
◆ setDefinition()
DI\CompiledContainer::setDefinition |
( |
string | $name, |
|
|
Definition | $definition ) |
|
protected |
◆ $delegateContainer
Container that wraps this container.
If none, points to $this.
◆ $entriesBeingResolved
array DI\Container::$entriesBeingResolved = [] |
|
protectedinherited |
Array of entries being resolved.
Used to avoid circular dependencies and infinite loops.
The documentation for this class was generated from the following file:
- lib/php-di/php-di/src/CompiledContainer.php