ContainerControllerResolver
extends ControllerResolver
in package
A controller resolver searching for a controller in a psr-11 container when using the "service:method" notation.
Tags
Table of Contents
- $container : mixed
- $logger : mixed
- $supportsScalarTypes : bool
- If scalar types exists.
- $supportsVariadic : bool
- If the ...$arg functionality is available.
- __construct() : mixed
- getArguments() : array<string|int, mixed>
- Returns the arguments to pass to the controller.
- getController() : callable|false
- Returns the Controller instance associated with a Request.
- createController() : mixed
- Returns a callable for the given controller.
- doGetArguments() : array<string|int, mixed>
- instantiateController() : object
- Returns an instantiated controller.
- getControllerError() : mixed
- throwExceptionIfControllerWasRemoved() : mixed
- typeMatchesRequestClass() : bool
Properties
$container
protected
mixed
$container
$logger
private
mixed
$logger
$supportsScalarTypes
If scalar types exists.
private
bool
$supportsScalarTypes
$supportsVariadic
If the ...$arg functionality is available.
private
bool
$supportsVariadic
Requires at least PHP 5.6.0 or HHVM 3.9.1
Methods
__construct()
public
__construct(ContainerInterface $container[, LoggerInterface $logger = null ]) : mixed
Parameters
- $container : ContainerInterface
- $logger : LoggerInterface = null
Return values
mixed —getArguments()
Returns the arguments to pass to the controller.
public
getArguments(Request $request, mixed $controller) : array<string|int, mixed>
Parameters
- $request : Request
- $controller : mixed
Tags
Return values
array<string|int, mixed> —An array of arguments to pass to the controller
getController()
Returns the Controller instance associated with a Request.
public
getController(Request $request) : callable|false
Parameters
- $request : Request
Return values
callable|false —A PHP callable representing the Controller, or false if this resolver is not able to determine the controller
createController()
Returns a callable for the given controller.
protected
createController(string $controller) : mixed
Parameters
- $controller : string
-
A Controller string
Tags
Return values
mixed —A PHP callable
doGetArguments()
protected
doGetArguments(Request $request, callable $controller, array<string|int, ReflectionParameter> $parameters) : array<string|int, mixed>
Parameters
- $request : Request
- $controller : callable
- $parameters : array<string|int, ReflectionParameter>
Tags
Return values
array<string|int, mixed> —The arguments to use when calling the action
instantiateController()
Returns an instantiated controller.
protected
instantiateController(mixed $class) : object
Parameters
- $class : mixed
-
A class name
Return values
object —getControllerError()
private
getControllerError(mixed $callable) : mixed
Parameters
- $callable : mixed
Return values
mixed —throwExceptionIfControllerWasRemoved()
private
throwExceptionIfControllerWasRemoved(string $controller[, Exception|Throwable|null $previous = null ]) : mixed
Parameters
- $controller : string
- $previous : Exception|Throwable|null = null
Return values
mixed —typeMatchesRequestClass()
private
typeMatchesRequestClass(ReflectionParameter $param, Request $request) : bool
Parameters
- $param : ReflectionParameter
- $request : Request