PHP Class Zend\Stratigility\FinalHandler

Exibir arquivo Open project: zendframework/zend-stratigility Class Usage Examples

Public Methods

Method Description
__construct ( array $options = [], Psr\Http\Message\ResponseInterface $response = null )
__invoke ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, mixed $err = null ) : Psr\Http\Message\ResponseInterface Handle incomplete requests
setOriginalResponse ( Psr\Http\Message\ResponseInterface $response = null ) Set the original response and response body size for comparison.

Private Methods

Method Description
completeResponse ( Psr\Http\Message\ResponseInterface $response, string $message ) : Psr\Http\Message\ResponseInterface Write the given message to the response and mark it complete.
create404 ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface Create a 404 status in the response
createDevelopmentErrorMessage ( mixed $error ) : string Create a complete error message for development purposes.
getUriFromRequest ( Psr\Http\Message\RequestInterface $request ) : Psr\Http\Message\UriInterface Retrieve the URI from the request.
handleError ( mixed $error, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface Handle an error condition
triggerError ( mixed $error, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response ) Trigger the error listener, if present

Method Details

__construct() public method

public __construct ( array $options = [], Psr\Http\Message\ResponseInterface $response = null )
$options array Options that change default override behavior.
$response Psr\Http\Message\ResponseInterface Original response, if any.

__invoke() public method

This handler should only ever be invoked if Next exhausts its stack. When that happens, one of three possibilities exists: - If an $err is present, create a 500 status with error details. - If the instance composes a response, and it differs from the response passed during invocation, return the invocation response; this is indicative of middleware calling $next to allow post-processing of a populated response. - Otherwise, a 404 status is created.
public __invoke ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, mixed $err = null ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\RequestInterface Request instance.
$response Psr\Http\Message\ResponseInterface Response instance.
$err mixed
return Psr\Http\Message\ResponseInterface

setOriginalResponse() public method

Set the original response and response body size for comparison.
public setOriginalResponse ( Psr\Http\Message\ResponseInterface $response = null )
$response Psr\Http\Message\ResponseInterface