Zend Framework  3.0
Public Member Functions | List of all members
FinalHandler Class Reference

Handle incomplete requests. More...

Public Member Functions

 __construct (array $options=[], ResponseInterface $response=null)
 
 __invoke (RequestInterface $request, ResponseInterface $response, $err=null)
 Handle incomplete requests.
 
 setOriginalResponse (ResponseInterface $response=null)
 Set the original response and response body size for comparison.
 

Detailed Description

Handle incomplete requests.

Constructor & Destructor Documentation

__construct ( array  $options = [],
ResponseInterface  $response = null 
)
Parameters
array$optionsOptions that change default override behavior.
null | ResponseInterface$responseOriginal response, if any.

Member Function Documentation

__invoke ( RequestInterface  $request,
ResponseInterface  $response,
  $err = null 
)

Handle incomplete requests.

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.
Parameters
RequestInterface$requestRequest instance.
ResponseInterface$responseResponse instance.
mixed$err
Returns
ResponseInterface
setOriginalResponse ( ResponseInterface  $response = null)

Set the original response and response body size for comparison.

Parameters
ResponseInterface$response