Class CakeContainerBridge
Bridge class that wraps CakePHP's built-in container to satisfy ContainerInterface.
This minimal bridge enables using the CakePHP container while maintaining backwards compatibility with code expecting ContainerInterface.
Namespace: Cake\Core
Method Summary
-
__construct() public
-
add() public
-
addServiceProvider() public
-
addShared() 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
Method Detail
__construct() ¶ public
__construct(Cake\Container\Container $container)
Parameters
-
Cake\Container\Container$container The wrapped CakePHP container
add() ¶ public
add(string $id, mixed $concrete = null, bool $overwrite = false): DefinitionInterface
Parameters
-
string$id -
mixed$concrete optional -
bool$overwrite optional
Returns
DefinitionInterfaceaddServiceProvider() ¶ public
addServiceProvider(ServiceProviderInterface $provider): static
Parameters
-
ServiceProviderInterface$provider
Returns
staticaddShared() ¶ public
addShared(string $id, mixed $concrete = null, bool $overwrite = false): DefinitionInterface
Parameters
-
string$id -
mixed$concrete optional -
bool$overwrite optional
Returns
DefinitionInterfacedelegate() ¶ public
delegate(Psr\Container\ContainerInterface $container): Psr\Container\ContainerInterface
Parameters
-
Psr\Container\ContainerInterface$container
Returns
Psr\Container\ContainerInterfaceextend() ¶ 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
Returns
mixedhas() ¶ 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
Returns
boolinflector() ¶ public
inflector(string $type, ?callable $callback = null): InflectorInterface
Parameters
-
string$type -
?callable$callback optional
Returns
InflectorInterface