PHP Class Phly\Conduit\FinalHandler

Mostrar archivo Open project: phly/conduit

Public Methods

Method Description
__construct ( array $options = [] )
__invoke ( Request $request, Response $response, mixed $err = null ) : Response Handle incomplete requests

Private Methods

Method Description
create404 ( Request $request, Response $response ) : Response Create a 404 status in the response
createDevelopmentErrorMessage ( $error )
getStatusCode ( mixed $error, Response $response ) : integer Determine status code
handleError ( mixed $error, Request $request, Response $response ) : Response Handle an error condition
triggerError ( mixed $error, Request $request, Response $response ) Trigger the error listener, if present

Method Details

__construct() public method

public __construct ( array $options = [] )
$options array Options that change default override behavior.

__invoke() public method

This handler should only ever be invoked if Next exhausts its stack. When that happens, we determine if an $err is present, and, if so, create a 500 status with error details. Otherwise, a 404 status is created.
public __invoke ( Request $request, Response $response, mixed $err = null ) : Response
$request Phly\Conduit\Http\Request Request instance.
$response Phly\Conduit\Http\Response Response instance.
$err mixed
return Phly\Conduit\Http\Response