RequestMatcherPlugin
in package
implements
Plugin
FinalYes
Apply a delegated plugin based on a request match.
Tags
Table of Contents
Interfaces
- Plugin
- A plugin is a middleware to transform the request and/or the response.
Properties
- $failurePlugin : Plugin|null
- $requestMatcher : RequestMatcher
- $successPlugin : Plugin|null
Methods
- __construct() : mixed
- handleRequest() : Promise
- Handle the request and return the response coming from the next callable.
Properties
$failurePlugin
private
Plugin|null
$failurePlugin
$requestMatcher
private
RequestMatcher
$requestMatcher
$successPlugin
private
Plugin|null
$successPlugin
Methods
__construct()
public
__construct(RequestMatcher $requestMatcher, Plugin|null $delegateOnMatch[, Plugin $delegateOnNoMatch = null ]) : mixed
Parameters
- $requestMatcher : RequestMatcher
- $delegateOnMatch : Plugin|null
- $delegateOnNoMatch : Plugin = null
handleRequest()
Handle the request and return the response coming from the next callable.
public
handleRequest(RequestInterface $request, callable $next, callable $first) : Promise
Parameters
- $request : RequestInterface
- $next : callable
-
Next middleware in the chain, the request is passed as the first argument
- $first : callable
-
First middleware in the chain, used to to restart a request
Return values
Promise —Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient)