PHP Class Aerys\StandardResponse

Inheritance: implements aerys\Response
Show file Open project: amphp/aerys

Public Methods

Method Description
__construct ( Generator $codec, Client $client )
__debugInfo ( ) : array
addHeader ( string $field, string $value ) : aerys\Response {@inheritDoc}
end ( string $finalBody = null ) Signify the end of streaming response output
flush ( ) Request that any buffered data be flushed to the client
push ( string $url, array $headers = null ) : aerys\Response {@inheritDoc}
setCookie ( string $name, string $value, array $flags = [] ) : aerys\Response {@inheritDoc}
setHeader ( string $field, string $value ) : aerys\Response {@inheritDoc}
setReason ( string $phrase ) : aerys\Response {@inheritDoc}
setStatus ( integer $code ) : aerys\Response {@inheritDoc}
state ( ) : integer {@inheritDoc}
stream ( string $partialBody ) : Amp\Promise Stream partial entity body data

Private Methods

Method Description
isValidHeaderField ( string $field ) : boolean
isValidHeaderValue ( string $value ) : boolean
isValidReasonPhrase ( string $phrase ) : boolean
setCookies ( )

Method Details

__construct() public method

public __construct ( Generator $codec, Client $client )
$codec Generator
$client Client

__debugInfo() public method

public __debugInfo ( ) : array
return array

addHeader() public method

{@inheritDoc}
public addHeader ( string $field, string $value ) : aerys\Response
$field string
$value string
return aerys\Response

end() public method

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();
public end ( string $finalBody = null )
$finalBody string Optional final body data to send

flush() public method

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

push() public method

{@inheritDoc}
public push ( string $url, array $headers = null ) : aerys\Response
$url string
$headers array
return aerys\Response

setCookie() public method

{@inheritDoc}
public setCookie ( string $name, string $value, array $flags = [] ) : aerys\Response
$name string
$value string
$flags array
return aerys\Response

setHeader() public method

{@inheritDoc}
public setHeader ( string $field, string $value ) : aerys\Response
$field string
$value string
return aerys\Response

setReason() public method

{@inheritDoc}
public setReason ( string $phrase ) : aerys\Response
$phrase string
return aerys\Response

setStatus() public method

{@inheritDoc}
public setStatus ( integer $code ) : aerys\Response
$code integer
return aerys\Response

state() public method

{@inheritDoc}
public state ( ) : integer
return integer

stream() public method

If response output has not yet started headers will also be sent when this method is invoked.
public stream ( string $partialBody ) : Amp\Promise
$partialBody string
return Amp\Promise to be succeeded whenever local buffers aren't full