class CallableDispatcher implements CallableDispatcher

Traits

Properties

static protected array<string, bool> $enumCache

Cached isEnum results keyed by class name.

from  ResolvesRouteDependencies
static protected null|ReflectionParameter>> $reflectionCache

Cached ReflectionParameter arrays keyed by callable object.

protected Container $container

The container instance.

protected PrecognitionCallableDispatcher|null $precognitionDispatcher

The cached precognition dispatcher instance.

Methods

static void
flushEnumCache()

Flush the static enum cache.

array
resolveClassMethodDependencies(array $parameters, object $instance, string $method)

Resolve the object method's type-hinted dependencies.

array
resolveMethodDependencies(array $parameters, array $reflectedParameters)

Resolve the given method's type-hinted dependencies.

mixed
transformDependency(ReflectionParameter $parameter, array $parameters, object $skippableValue)

Attempt to transform the given parameter into a class instance.

bool
alreadyInParameters(string $class, array $parameters)

Determine if an object of the given class is in a list of parameters.

void
spliceIntoParameters(array $parameters, int $offset, mixed $value)

Splice the given value into the parameter list.

__construct(Container $container)

Create a new callable dispatcher instance.

mixed
dispatch(Route $route, callable $callable)

Dispatch a request to a given callable.

array
resolveParameters(Route $route, callable $callable)

Resolve the parameters for the callable.

static void
flushCache()

Flush the static reflection cache.

static void
flushState()

Flush all static state.

Details

static void flushEnumCache()

Flush the static enum cache.

Boot or tests only. Clears the process-wide enum lookup cache shared by every coroutine; next resolution re-resolves.

Return Value

void

protected array resolveClassMethodDependencies(array $parameters, object $instance, string $method)

Resolve the object method's type-hinted dependencies.

Parameters

array $parameters
object $instance
string $method

Return Value

array

array resolveMethodDependencies(array $parameters, array $reflectedParameters)

Resolve the given method's type-hinted dependencies.

Parameters

array $parameters
array $reflectedParameters

Return Value

array

protected mixed transformDependency(ReflectionParameter $parameter, array $parameters, object $skippableValue)

Attempt to transform the given parameter into a class instance.

Parameters

ReflectionParameter $parameter
array $parameters
object $skippableValue

Return Value

mixed

protected bool alreadyInParameters(string $class, array $parameters)

Determine if an object of the given class is in a list of parameters.

Parameters

string $class
array $parameters

Return Value

bool

protected void spliceIntoParameters(array $parameters, int $offset, mixed $value)

Splice the given value into the parameter list.

Parameters

array $parameters
int $offset
mixed $value

Return Value

void

at line 45
__construct(Container $container)

Create a new callable dispatcher instance.

Parameters

Container $container

at line 53
mixed dispatch(Route $route, callable $callable)

Dispatch a request to a given callable.

Parameters

Route $route
callable $callable

Return Value

mixed

at line 71
protected array resolveParameters(Route $route, callable $callable)

Resolve the parameters for the callable.

Routes supply closures or invokable objects, while the public dispatcher contract also permits other native callable forms.

Parameters

Route $route
callable $callable

Return Value

array

at line 98
static void flushCache()

Flush the static reflection cache.

Boot or tests only. Clears the process-wide reflection cache shared by every coroutine; next dispatch re-reflects.

Return Value

void

at line 106
static void flushState()

Flush all static state.

Return Value

void