Class ReflectionContainer
Namespace: Cake\Container
Property Summary
-
$cache protected
array -
$cacheResolutions protected
bool -
$container protected
Cake\Container\DefinitionContainerInterface|null
Method Summary
-
__construct() public
-
call() public
-
get() public
-
getContainer() abstract public
-
getNew() public
Get a new instance, bypassing the cache.
-
has() public
Returns true if the container can return an entry for the given identifier. Returns false otherwise.
-
reflectArguments() public
-
resolveArguments() public
-
setContainer() public
Method Detail
__construct() ¶ public
__construct(bool $cacheResolutions = false)
Parameters
-
bool$cacheResolutions optional
call() ¶ public
call(callable|string $callable, array $args = []): mixed
Parameters
-
callable|string$callable -
array$args optional
Returns
mixedThrows
Psr\Container\ContainerExceptionInterfacePsr\Container\NotFoundExceptionInterfaceReflectionExceptiongetContainer() ¶ abstract public
getContainer(): Cake\Container\DefinitionContainerInterface
Returns
Cake\Container\DefinitionContainerInterfacegetNew() ¶ public
getNew(string $id, array<string, mixed> $args = []): mixed
Get a new instance, bypassing the cache.
Parameters
-
string$id -
array<string, mixed>$args optional
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
boolreflectArguments() ¶ public
reflectArguments(ReflectionFunctionAbstract $method, array $args = []): array
Parameters
-
ReflectionFunctionAbstract$method -
array$args optional
Returns
arrayresolveArguments() ¶ public
resolveArguments(array<Cake\Container\Argument\LiteralArgument|Cake\Container\Argument\ResolvableArgument> $arguments): array
Parameters
-
array<Cake\Container\Argument\LiteralArgument|Cake\Container\Argument\ResolvableArgument>$arguments
Returns
arraysetContainer() ¶ public
setContainer(Cake\Container\DefinitionContainerInterface $container): $this
Parameters
-
Cake\Container\DefinitionContainerInterface$container
Returns
$this