class DevelopmentHandler extends Handler implements HandlerInterface

Development handler.

Traits

Basic content negotiation.

Properties

protected Request $request Request instance.
protected Response $response Response instance.
protected Run $whoops Whoops.
protected Application $app Application instance.

Methods

bool
expectsType(array $mimeTypes, string|null $suffix = null)

Does the client expect the provided mime type?

bool
expectsJson()

Does the client expect JSON?

bool
expectsXml()

Does the client expect XML?

bool
respondWithType(array $mimeTypes, string|null $suffix = null)

Should we respond with the provided mime type?

bool
respondWithJson()

Should we respond with JSON?

bool
respondWithXml()

Should we respond with XML?

int
getStatusCode(Throwable $exception)

Returns the status code that we should send.

from Handler
sendResponse(Response $response, Throwable $exception)

Sends response and adds any aditional headers.

from Handler
__construct(Run $whoops, Request $request, Response $response, Application $app)

Constructor.

HandlerInterface
getWhoopsHandler()

Returns a Whoops handler.

configureWhoops()

Configure Whoops.

mixed
handle(Throwable $exception)

Handles the exception.

Details

protected bool expectsType(array $mimeTypes, string|null $suffix = null)

Does the client expect the provided mime type?

Parameters

array $mimeTypes Mime types
string|null $suffix Mime type suffix

Return Value

bool

protected bool expectsJson()

Does the client expect JSON?

Return Value

bool

protected bool expectsXml()

Does the client expect XML?

Return Value

bool

protected bool respondWithType(array $mimeTypes, string|null $suffix = null)

Should we respond with the provided mime type?

Parameters

array $mimeTypes Mime types
string|null $suffix Mime type suffix

Return Value

bool

protected bool respondWithJson()

Should we respond with JSON?

Return Value

bool

protected bool respondWithXml()

Should we respond with XML?

Return Value

bool

in Handler at line 31
protected int getStatusCode(Throwable $exception)

Returns the status code that we should send.

Parameters

Throwable $exception Exception

Return Value

int

in Handler at line 42
protected sendResponse(Response $response, Throwable $exception)

Sends response and adds any aditional headers.

Parameters

Response $response Response
Throwable $exception Exception

at line 65
__construct(Run $whoops, Request $request, Response $response, Application $app)

Constructor.

Parameters

Run $whoops Whoops
Request $request Request
Response $response Response
Application $app Application

at line 83
protected HandlerInterface getWhoopsHandler()

Returns a Whoops handler.

Return Value

HandlerInterface

at line 122
protected configureWhoops()

Configure Whoops.

at line 134
mixed handle(Throwable $exception)

Handles the exception.

Parameters

Throwable $exception Exception to handle

Return Value

mixed