Class Container
Dependency Injection container
Based on the container out of League\Container
Property Summary
- $defaultToShared protected
boolean - $definitions protected
DefinitionAggregateInterface - $delegates protected
ContainerInterface[] - $inflectors protected
InflectorAggregateInterface - $providers protected
ServiceProviderAggregateInterface
Method Summary
-
__construct() public
-
add() public
-
addServiceProvider() public
-
addShared() public
-
defaultToShared() public
-
delegate() public
-
extend() public
-
get() public
Finds an entry of the container by its identifier and returns it.
-
getNew() public
-
has() public
Returns true if the container can return an entry for the given identifier. Returns false otherwise.
-
inflector() public
-
resolve() protected
Method Detail
__construct() public
__construct(DefinitionAggregateInterface $definitions = null, ServiceProviderAggregateInterface $providers = null, InflectorAggregateInterface $inflectors = null)
Parameters
-
DefinitionAggregateInterface$definitions optional -
ServiceProviderAggregateInterface$providers optional -
InflectorAggregateInterface$inflectors optional
add() public
add(string $id, mixed $concrete = null): DefinitionInterface
Parameters
-
string$id - $concrete optional
Returns
DefinitionInterfaceaddServiceProvider() public
addServiceProvider(ServiceProviderInterface $provider): self
Parameters
-
ServiceProviderInterface$provider
Returns
selfaddShared() public
addShared(string $id, mixed $concrete = null): DefinitionInterface
Parameters
-
string$id - $concrete optional
Returns
DefinitionInterfacedefaultToShared() public
defaultToShared(bool $shared = true): ContainerInterface
Parameters
-
bool$shared optional
Returns
ContainerInterfacedelegate() public
delegate(ContainerInterface $container): self
Parameters
-
ContainerInterface$container
Returns
selfextend() public
extend(string $id): DefinitionInterface
Parameters
-
string$id
Returns
DefinitionInterfaceget() public
get(string $id): mixed
Finds an entry of the container by its identifier and returns it.
Parameters
-
string$id Identifier of the entry to look for.
Returns
mixedThrows
NotFoundExceptionInterfaceNo entry was found for **this** identifier.
ContainerExceptionInterfaceError while retrieving the entry.
getNew() public
getNew(mixed $id)
Parameters
- $id
has() public
has(string $id): bool
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.
Returns
boolinflector() public
inflector(string $type, callable $callback = null): InflectorInterface
Parameters
-
string$type -
callable$callback optional
Returns
InflectorInterfaceresolve() protected
resolve(mixed $id, bool $new = false)
Parameters
- $id
-
bool$new optional
Property Detail
$defaultToShared protected
Type
boolean$definitions protected
Type
DefinitionAggregateInterface$delegates protected
Type
ContainerInterface[]$inflectors protected
Type
InflectorAggregateInterface$providers protected
Type
ServiceProviderAggregateInterface
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Core.Container.html