Dependency Injection container
Based on the container out of League\Container
boolean
DefinitionAggregateInterface
ContainerInterface[]
InflectorAggregateInterface
ServiceProviderAggregateInterface
Finds an entry of the container by its identifier and returns it.
Returns true if the container can return an entry for the given identifier. Returns false otherwise.
__construct(DefinitionAggregateInterface $definitions = null, ServiceProviderAggregateInterface $providers = null, InflectorAggregateInterface $inflectors = null)
DefinitionAggregateInterface
$definitions optional ServiceProviderAggregateInterface
$providers optional InflectorAggregateInterface
$inflectors optional add(string $id, mixed $concrete = null): DefinitionInterface
string
$id DefinitionInterface
addServiceProvider(ServiceProviderInterface $provider): self
ServiceProviderInterface
$provider self
addShared(string $id, mixed $concrete = null): DefinitionInterface
string
$id DefinitionInterface
defaultToShared(bool $shared = true): ContainerInterface
bool
$shared optional ContainerInterface
delegate(ContainerInterface $container): self
ContainerInterface
$container self
extend(string $id): DefinitionInterface
string
$id DefinitionInterface
get(string $id): mixed
Finds an entry of the container by its identifier and returns it.
string
$id Identifier of the entry to look for.
mixed
NotFoundExceptionInterface
ContainerExceptionInterface
getNew(mixed $id)
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
.
string
$id Identifier of the entry to look for.
bool
inflector(string $type, callable $callback = null): InflectorInterface
string
$type callable
$callback optional InflectorInterface
resolve(mixed $id, bool $new = false)
bool
$new optional boolean
DefinitionAggregateInterface
ContainerInterface[]
InflectorAggregateInterface
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