Class Inflector
Property Summary
-
$callback protected
callable|null -
$container protected
Cake\Container\ContainerInterface|null -
$methods protected
array -
$properties protected
array
Method Summary
-
__construct() public
-
getContainer() abstract public
-
getType() public
-
inflect() public
-
invokeMethod() public
-
invokeMethods() public
-
reflectArguments() public
-
resolveArgumentFromAttribute() protected
Attempt to resolve a parameter's value from one of its PHP attributes.
-
resolveArguments() public
-
resolveContextualArgumentFromAttribute() protected
Attempt to resolve a parameter's value from a contextual PHP attribute.
Contextual attributes receive the parameter being resolved alongside the container, enabling resolution by parameter name/type. Attributes not implementing {@see ContextualAttributeInterface} return false here and fall through to {@see resolveArgumentFromAttribute()}.
The container is deliberately passed as an argument instead of using {@see ContainerAwareInterface}: with a standalone ReflectionContainer there is no parent container to inject, while the resolving instance itself always satisfies the PSR interface expected here.
-
setContainer() public
-
setProperties() public
-
setProperty() public
Method Detail
__construct() ¶ public
__construct(string $type, callable|null $callback = null)
Parameters
-
string$type -
callable|null$callback optional
getContainer() ¶ abstract public
getContainer(): Cake\Container\ContainerInterface
Returns
Cake\Container\ContainerInterfaceinvokeMethod() ¶ public
invokeMethod(string $name, array $args): InflectorInterface
Parameters
-
string$name -
array$args
Returns
InflectorInterfaceinvokeMethods() ¶ public
invokeMethods(array $methods): InflectorInterface
Parameters
-
array$methods
Returns
InflectorInterfacereflectArguments() ¶ public
reflectArguments(ReflectionFunctionAbstract $method, array $args = []): array
Parameters
-
ReflectionFunctionAbstract$method -
array$args optional
Returns
arrayresolveArgumentFromAttribute() ¶ protected
resolveArgumentFromAttribute(ReflectionAttribute<object> $attribute): Cake\Container\Argument\LiteralArgumentInterface|false
Attempt to resolve a parameter's value from one of its PHP attributes.
Parameters
-
ReflectionAttribute<object>$attribute The attribute to attempt to resolve.
Returns
Cake\Container\Argument\LiteralArgumentInterface|falseresolveArguments() ¶ public
resolveArguments(array<Cake\Container\Argument\ArgumentInterface> $arguments): array
Parameters
-
array<Cake\Container\Argument\ArgumentInterface>$arguments
Returns
arrayresolveContextualArgumentFromAttribute() ¶ protected
resolveContextualArgumentFromAttribute(ReflectionAttribute<object> $attribute, ReflectionParameter $parameter): Cake\Container\Argument\LiteralArgumentInterface|false
Attempt to resolve a parameter's value from a contextual PHP attribute.
Contextual attributes receive the parameter being resolved alongside the container, enabling resolution by parameter name/type. Attributes not implementing {@see ContextualAttributeInterface} return false here and fall through to {@see resolveArgumentFromAttribute()}.
The container is deliberately passed as an argument instead of using {@see ContainerAwareInterface}: with a standalone ReflectionContainer there is no parent container to inject, while the resolving instance itself always satisfies the PSR interface expected here.
Parameters
-
ReflectionAttribute<object>$attribute The attribute to attempt to resolve.
-
ReflectionParameter$parameter The parameter being resolved.
Returns
Cake\Container\Argument\LiteralArgumentInterface|falsesetContainer() ¶ public
setContainer(Cake\Container\ContainerInterface $container): ContainerAwareInterface
Parameters
-
Cake\Container\ContainerInterface$container
Returns
ContainerAwareInterfacesetProperties() ¶ public
setProperties(array $properties): InflectorInterface
Parameters
-
array$properties
Returns
InflectorInterfacesetProperty() ¶ public
setProperty(string $property, mixed $value): InflectorInterface
Parameters
-
string$property -
mixed$value
Returns
InflectorInterface