MiddlewareMock
extends Middleware
in package
Table of Contents
Properties
- $services : Arrayable
- $switchedOff : bool
Methods
- __construct() : mixed
- afterRequest() : mixed
- If provided, this hook will be called after the middleware runs against the request.
- afterResponse() : mixed
- If provided, this hook is called after the middleware runs against the response.
- beforeRequest() : mixed
- This hook is called before the middleware runs against the request.
- beforeResponse() : mixed
- This method is called before the middleware runs against the response.
- execute() : void
- This method is called to run the middleware. Every middleware must implement this method.
- limitServicesTo() : Arrayable
- Only those services that are listed here will trigger the middleware to run
- onRequest() : void
- onResponse() : void
- _runMiddleware() : void
Properties
$services
private
Arrayable
$services
The services that the middleware can run against otherwise, will run against all services.
$switchedOff
private
bool
$switchedOff
= false
If the middleware is switched off, it will not run.
Methods
__construct()
public
__construct() : mixed
afterRequest()
If provided, this hook will be called after the middleware runs against the request.
public
afterRequest() : mixed
afterResponse()
If provided, this hook is called after the middleware runs against the response.
public
afterResponse() : mixed
beforeRequest()
This hook is called before the middleware runs against the request.
public
beforeRequest() : mixed
beforeResponse()
This method is called before the middleware runs against the response.
public
beforeResponse() : mixed
execute()
This method is called to run the middleware. Every middleware must implement this method.
public
execute(Request $request, Response|null $response, MiddlewareChain $chain) : void
Parameters
- $request : Request
-
- The request object
- $response : Response|null
-
- The response object
- $chain : MiddlewareChain
limitServicesTo()
Only those services that are listed here will trigger the middleware to run
public
limitServicesTo() : Arrayable
Return values
ArrayableonRequest()
public
onRequest(Request $request) : void
Parameters
- $request : Request
Tags
onResponse()
public
onResponse(Response $response) : void
Parameters
- $response : Response
Tags
_runMiddleware()
private
_runMiddleware(mixed $request, mixed $response) : void
Parameters
- $request : mixed
- $response : mixed