class ArgumentsResolver implements ArgumentsResolverInterface (View source)

Resolves the arguments to pass to a callable.

Properties

protected array $scalars

An associative array of parameter names to scalar candidate values.

protected array $objects

An associative array of parameter names to object candidate values.

protected array $wildcards

An array object candidates tried on every parameter regardless of name.

Methods

__construct(array $scalars, array $objects, array $wildcards)

Constructs a new ArgumentsResolver.

array
getArguments(callable $callable)

Gets arguments suitable for passing to the given callable.

mixed
getArgument(ReflectionParameter $parameter)

Gets the argument value for a parameter.

getReflector(callable $callable)

Gets a reflector for the access check callable.

handleUnresolvedArgument(ReflectionParameter $parameter)

Handles unresolved arguments for getArgument().

Details

__construct(array $scalars, array $objects, array $wildcards)

Constructs a new ArgumentsResolver.

Parameters

array $scalars

An associative array of parameter names to scalar candidate values.

array $objects

An associative array of parameter names to object candidate values.

array $wildcards

An array object candidates tried on every parameter regardless of its name.

array getArguments(callable $callable)

Gets arguments suitable for passing to the given callable.

Parameters

callable $callable

Return Value

array

An array of arguments to pass to the callable.

Exceptions

RuntimeException

protected mixed getArgument(ReflectionParameter $parameter)

Gets the argument value for a parameter.

Parameters

ReflectionParameter $parameter

The parameter of a callable to get the value for.

Return Value

mixed

The value of the requested parameter value.

Exceptions

RuntimeException

protected ReflectionFunctionAbstract getReflector(callable $callable)

Gets a reflector for the access check callable.

The access checker may be either a procedural function (in which case the callable is the function name) or a method (in which case the callable is an array of the object and method name).

Parameters

callable $callable

The callable (either a function or a method).

Return Value

ReflectionFunctionAbstract

The ReflectionMethod or ReflectionFunction to introspect the callable.

protected handleUnresolvedArgument(ReflectionParameter $parameter)

Handles unresolved arguments for getArgument().

Subclasses that override this method may return a default value instead of throwing an exception.

Parameters

ReflectionParameter $parameter

Exceptions

RuntimeException