\Zend\Diactoros\ResponseSapiStreamEmitter

Summary

Methods
Properties
Constants
emit()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
assertNoPreviousOutput()
emitStatusLine()
emitHeaders()
filterHeader()
emitBody()
emitBodyRange()
parseContentRange()
No private properties found
N/A

Methods

emit()

emit(\Psr\Http\Message\ResponseInterface  $response, integer  $maxBufferLength = 8192) 

Emits a response for a PHP SAPI environment.

Emits the status line and headers via the header() function, and the body content via the output buffer.

Parameters

\Psr\Http\Message\ResponseInterface $response
integer $maxBufferLength

Maximum output buffering size for each iteration

assertNoPreviousOutput()

assertNoPreviousOutput() 

Checks to see if content has previously been sent.

If either headers have been sent or the output buffer contains content, raises an exception.

Throws

\RuntimeException

if headers have already been sent.

\RuntimeException

if output is present in the output buffer.

emitStatusLine()

emitStatusLine(\Psr\Http\Message\ResponseInterface  $response) 

Emit the status line.

Emits the status line using the protocol version and status code from the response; if a reason phrase is available, it, too, is emitted.

It is important to mention that this method should be called after emitHeaders() in order to prevent PHP from changing the status code of the emitted response.

Parameters

\Psr\Http\Message\ResponseInterface $response

emitHeaders()

emitHeaders(\Psr\Http\Message\ResponseInterface  $response) 

Emit response headers.

Loops through each header, emitting each; if the header value is an array with multiple values, ensures that each is sent in such a way as to create aggregate headers (instead of replace the previous).

Parameters

\Psr\Http\Message\ResponseInterface $response

filterHeader()

filterHeader(string  $header) : string

Filter a header name to wordcase

Parameters

string $header

Returns

string

emitBody()

emitBody(\Psr\Http\Message\ResponseInterface  $response, integer  $maxBufferLength) 

Emit the message body.

Parameters

\Psr\Http\Message\ResponseInterface $response
integer $maxBufferLength

emitBodyRange()

emitBodyRange(array  $range, \Psr\Http\Message\ResponseInterface  $response, integer  $maxBufferLength) 

Emit a range of the message body.

Parameters

array $range
\Psr\Http\Message\ResponseInterface $response
integer $maxBufferLength

parseContentRange()

parseContentRange(string  $header) : false|array

Parse content-range header http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16

Parameters

string $header

Returns

false|array —

[unit, first, last, length]; returns false if no content range or an invalid content range is provided