Trait ArgumentResolverTrait
Method Summary
-
getContainer() abstract 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.
Method Detail
reflectArguments() ¶ 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 $arguments): array
Parameters
-
array$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|false