ResponseService
class ResponseService (View source)
A collection of tools for the creation of responses.
Methods
Send output based on a response object.
Send a request's headers to the client.
Send a request's body to the client.
Create a new response object.
Get a cloned response with the passed string as the body.
Get a cloned response, json encoding the passed data as the body.
Get an error response, with status headers and rendering a suitable view as the body.
Details
at line 44
__construct(RequestInterface $request, ViewService $view_service)
Constructor.
at line 57
void
respond(ResponseInterface $response)
Send output based on a response object.
at line 71
void
sendHeaders(ResponseInterface $response)
Send a request's headers to the client.
at line 133
void
sendBody(ResponseInterface $response, integer $chunk_size = 4096)
Send a request's body to the client.
at line 188
ResponseInterface
response()
Create a new response object.
at line 198
ResponseInterface
output(string $output)
Get a cloned response with the passed string as the body.
at line 210
ResponseInterface
json(mixed $data)
Get a cloned response, json encoding the passed data as the body.
at line 223
RedirectResponse
redirect(RequestInterface $request = null)
Get a cloned response, with location and status headers.
at line 234
ResponseInterface
error(integer $status)
Get an error response, with status headers and rendering a suitable view as the body.