TestHttpKernel
extends HttpKernel
in package
implements
ControllerResolverInterface, ArgumentResolverInterface
HttpKernel notifies events to convert a Request object to a Response one.
Interfaces, Classes and Traits
- ControllerResolverInterface
- A ControllerResolverInterface implementation knows how to determine the controller to execute based on a Request object.
- ArgumentResolverInterface
- An ArgumentResolverInterface instance knows how to determine the arguments for a specific action.
Table of Contents
- $backendRequest : mixed
- $body : mixed
- $called : mixed
- $catch : mixed
- $customizer : mixed
- $dispatcher : mixed
- $headers : mixed
- $requestStack : mixed
- $resolver : mixed
- $status : mixed
- $argumentResolver : mixed
- __construct() : mixed
- assert() : mixed
- callController() : 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.
- handle() : Response
- Handles a Request to convert it to a Response.
- hasBeenCalled() : mixed
- isCatchingExceptions() : mixed
- reset() : mixed
- terminate() : mixed
- Terminates a request/response cycle.
- filterResponse() : Response
- Filters a response object.
- finishRequest() : mixed
- Publishes the finish request event, then pop the request from the stack.
- handleException() : Response
- Handles an exception by trying to convert it to a Response.
- handleRaw() : Response
- Handles a request to convert it to a response.
- varToString() : mixed
- Returns a human-readable string for the specified variable.
Properties
$backendRequest
protected
mixed
$backendRequest
$body
protected
mixed
$body
$called
protected
mixed
$called
= false
$catch
protected
mixed
$catch
= false
$customizer
protected
mixed
$customizer
$dispatcher
protected
mixed
$dispatcher
$headers
protected
mixed
$headers
$requestStack
protected
mixed
$requestStack
$resolver
protected
mixed
$resolver
$status
protected
mixed
$status
$argumentResolver
private
mixed
$argumentResolver
Methods
__construct()
public
__construct(mixed $body, mixed $status, mixed $headers[, Closure $customizer = null ]) : mixed
Parameters
- $body : mixed
- $status : mixed
- $headers : mixed
- $customizer : Closure = null
Return values
mixed —assert()
public
assert(Closure $callback) : mixed
Parameters
- $callback : Closure
Return values
mixed —callController()
public
callController(Request $request) : mixed
Parameters
- $request : Request
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
-
A Request instance
- $controller : mixed
-
A PHP callable
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
As several resolvers can exist for a single application, a resolver must return false when it is not able to determine the controller.
The resolver must only throw an exception when it should be able to load a controller but cannot because of some errors made by the developer.
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
handle()
Handles a Request to convert it to a Response.
public
handle(Request $request[, mixed $type = HttpKernelInterface::MASTER_REQUEST ][, mixed $catch = false ]) : Response
Parameters
- $request : Request
-
A Request instance
- $type : mixed = HttpKernelInterface::MASTER_REQUEST
-
The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
- $catch : mixed = false
-
Whether to catch exceptions or not
Return values
Response —A Response instance
hasBeenCalled()
public
hasBeenCalled() : mixed
Return values
mixed —isCatchingExceptions()
public
isCatchingExceptions() : mixed
Return values
mixed —reset()
public
reset() : mixed
Return values
mixed —terminate()
Terminates a request/response cycle.
public
terminate(Request $request, Response $response) : mixed
Parameters
Return values
mixed —filterResponse()
Filters a response object.
private
filterResponse(Response $response, Request $request, int $type) : Response
Parameters
- $response : Response
-
A Response instance
- $request : Request
-
An error message in case the response is not a Response object
- $type : int
-
The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
Tags
Return values
Response —The filtered Response instance
finishRequest()
Publishes the finish request event, then pop the request from the stack.
private
finishRequest(Request $request, int $type) : mixed
Note that the order of the operations is important here, otherwise operations such as can lead to weird results.
Parameters
- $request : Request
- $type : int
Return values
mixed —handleException()
Handles an exception by trying to convert it to a Response.
private
handleException(Exception $e, Request $request, int $type) : Response
Parameters
- $e : Exception
-
An \Exception instance
- $request : Request
-
A Request instance
- $type : int
-
The type of the request
Tags
Return values
Response —A Response instance
handleRaw()
Handles a request to convert it to a response.
private
handleRaw(Request $request[, int $type = self::MASTER_REQUEST ]) : Response
Exceptions are not caught.
Parameters
- $request : Request
-
A Request instance
- $type : int = self::MASTER_REQUEST
-
The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
Tags
Return values
Response —A Response instance
varToString()
Returns a human-readable string for the specified variable.
private
varToString(mixed $var) : mixed
Parameters
- $var : mixed