PHP Class Zend\Expressive\ErrorMiddlewarePipe

Normal MiddlewarePipe implementations implement Zend\Stratigility\MiddlewareInterface, which can be consumed as normal middleware, but not as error middleware, as the signature for error middleware differs. This class wraps a MiddlewarePipe, and consumes its internal pipeline within a functor signature that works for error middleware. It is not implemented as an extension of MiddlewarePipe, as that class implements the MiddlewareInterface, which prevents its use as error middleware.
Show file Open project: zendframework/zend-expressive

Public Methods

Method Description
__construct ( MiddlewarePipe $pipeline )
__invoke ( mixed $error, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out ) : Psr\Http\Message\ResponseInterface Handle an error request.

Private Methods

Method Description
decorateRequest ( Psr\Http\Message\ServerRequestInterface $request ) : Request Decorate the request with the Stratigility decorator.
decorateResponse ( Psr\Http\Message\ResponseInterface $response ) : Response Decorate the response with the Stratigility decorator.
getInternalPipeline ( ) : SplQueue Retrieve the internal pipeline from the composed MiddlewarePipe.

Method Details

__construct() public method

public __construct ( MiddlewarePipe $pipeline )
$pipeline Zend\Stratigility\MiddlewarePipe

__invoke() public method

This is essentially a version of the MiddlewarePipe that acts as a pipeline for solely error middleware; it's primary use case is to allow configuring arrays of error middleware as a single pipeline. Operation is identical to MiddlewarePipe, with the single exception that $next is called with the $error argument.
public __invoke ( mixed $error, Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out ) : Psr\Http\Message\ResponseInterface
$error mixed
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$out callable
return Psr\Http\Message\ResponseInterface