Aerys\StandardResponse classStandardResponse implementsAerys\Response

Summary

Properties

Methods

Properties

Methods

__construct —public function__construct(Generator$codec,Aerys\Client$client)
No documentation.
Type Parameter Description Default Value
Generator $codec No documentation. none
Aerys\Client $client No documentation. none
__debugInfo —public function__debugInfo():array
No documentation.
setStatus —public functionsetStatus(int$code):self

Set the numeric HTTP status code

If not assigned this value defaults to 200.

Type Parameter Description Default Value
int $code An integer in the range [100-599] none
setReason —public functionsetReason(string$phrase):self

Set the optional HTTP reason phrase

Type Parameter Description Default Value
string $phrase A human readable string describing the status code none
addHeader —public functionaddHeader(string$field,string$value):self

Append the specified header

Type Parameter Description Default Value
string $field No documentation. none
string $value No documentation. none
setHeader —public functionsetHeader(string$field,string$value):self

Set the specified header

This method will replace any existing headers for the specified field.

Type Parameter Description Default Value
string $field No documentation. none
string $value No documentation. none
setCookie —public functionsetCookie(string$name,string$value,array$flags =[]):self

Provides an easy API to set cookie headers Those who prefer using addHeader() may do so.

Type Parameter Description Default Value
string $name No documentation. none
string $value No documentation. none
array $flags Shall be an array of key => value pairs and/or unkeyed values as per https://tools.ietf.org/html/rfc6265#section-5.2.1 []
stream —public functionstream(string$partialBody):Amp\Promise

Stream partial entity body data

If response output has not yet started headers will also be sent when this method is invoked.

Type Parameter Description Default Value
string $partialBody A portion of the response entity body none
flush —public functionflush()

Request that any buffered data be flushed to the client

This method only makes sense when streaming output via Response::stream(). Invoking it before calling stream() or after send()/end() is a logic error.

end —public functionend(string$finalBody =null)

Signify the end of streaming response output

User applications are NOT required to call Response::end() as the server will handle this automatically as needed.

Passing the optional $finalBody is equivalent to the following:

$response->stream($finalBody);
$response->end();
Type Parameter Description Default Value
string $finalBody Optional final body data to send null
push —public functionpush(string$url,array$headers =null):self

Indicate resources which a client likely needs to fetch. (e.g. Link: preload or HTTP/2 Server Push)

Type Parameter Description Default Value
string $url The URL this request should be dispatched to none
array $headers Optional custom headers, else the server will try to reuse headers from the last request null
state —public functionstate():int

Retrieve the current response state

The response state is a bitmask of the following flags: