abstract class ResponseInformationHelper (View source)

Helper to extract various information from PSR-7 responses.

Methods

static ResponseInterface
createFromRaw(string $rawResponse)

Creates a response from the given raw, that is plain text, HTTP response.

static string
getStatusMessageByCode(int $statusCode)

Returns the human-readable message for the given status code.

static string
generateStatusLine(ResponseInterface $response)

Return the Request-Line of this Request Message, consisting of the method, the URI and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.

static array
prepareHeaders(ResponseInterface $response)

Prepare array of header lines for this response

static ResponseInterface
makeStandardsCompliant(ResponseInterface $response, RequestInterface $request)

Analyzes this response, considering the given request and makes additions or removes certain headers in order to make the response compliant to RFC 2616 and related standards.

static void
sendStream(StreamInterface $stream)

No description

Details

static ResponseInterface createFromRaw(string $rawResponse)

Creates a response from the given raw, that is plain text, HTTP response.

Parameters

string $rawResponse

Return Value

ResponseInterface

Exceptions

InvalidArgumentException

static string getStatusMessageByCode(int $statusCode)

Returns the human-readable message for the given status code.

Parameters

int $statusCode

Return Value

string

static string generateStatusLine(ResponseInterface $response)

Return the Request-Line of this Request Message, consisting of the method, the URI and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.

Parameters

ResponseInterface $response

Return Value

string

See also

http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1

static array prepareHeaders(ResponseInterface $response)

Prepare array of header lines for this response

Parameters

ResponseInterface $response

Return Value

array

static ResponseInterface makeStandardsCompliant(ResponseInterface $response, RequestInterface $request)

Analyzes this response, considering the given request and makes additions or removes certain headers in order to make the response compliant to RFC 2616 and related standards.

It is recommended to call this method before the response is sent and Flow does so by default in its built-in HTTP request handler.

Parameters

ResponseInterface $response
RequestInterface $request

The corresponding request

Return Value

ResponseInterface

static void sendStream(StreamInterface $stream)

No description

Parameters

StreamInterface $stream

Return Value

void