class RequestHandler implements HttpRequestHandlerInterface (View source)

A request handler which can handle HTTP requests.

Properties

protected Bootstrap $bootstrap
protected MiddlewaresChain $middlewaresChain
protected ServerRequestInterface $httpRequest
protected ResponseInterface $httpResponse
Closure $exit

Make exit() a closure so it can be manipulated during tests

Methods

__construct(Bootstrap $bootstrap)

No description

mixed
canHandleRequest()

This request handler can handle any web request.

int
getPriority()

Returns the priority - how eager the handler is to actually handle the request.

void
handleRequest()

Handles a HTTP request

ServerRequestInterface
getHttpRequest()

Returns the currently handled HTTP request

ResponseInterface|null
getHttpResponse() deprecated

Returns the HTTP response corresponding to the currently handled request

void
boot()

Boots up Flow to runtime

void
resolveDependencies()

Resolves a few dependencies of this request handler which can't be resolved automatically due to the early stage of the boot process this request handler is invoked at.

sendResponse(ResponseInterface $response)

Send the HttpResponse of the component context to the browser and flush all output buffers.

Details

__construct(Bootstrap $bootstrap)

No description

Parameters

Bootstrap $bootstrap

mixed canHandleRequest()

This request handler can handle any web request.

Return Value

mixed

true or an integer > 0 if it can handle the request, otherwise false or an integer < 0

int getPriority()

Returns the priority - how eager the handler is to actually handle the request.

Return Value

int

The priority of the request handler

void handleRequest()

Handles a HTTP request

Return Value

void

ServerRequestInterface getHttpRequest()

Returns the currently handled HTTP request

Return Value

ServerRequestInterface

ResponseInterface|null getHttpResponse() deprecated

deprecated since 6.0. Don't depend on this method. The HTTP response only exists after the innermost middleware (dispatch) is done. For that stage use a middleware instead.

Returns the HTTP response corresponding to the currently handled request

Return Value

ResponseInterface|null

protected void boot()

Boots up Flow to runtime

Return Value

void

protected void resolveDependencies()

Resolves a few dependencies of this request handler which can't be resolved automatically due to the early stage of the boot process this request handler is invoked at.

Return Value

void

protected sendResponse(ResponseInterface $response)

Send the HttpResponse of the component context to the browser and flush all output buffers.

Parameters

ResponseInterface $response