SapiStreamEmitter
in package
implements
EmitterInterface
uses
SapiEmitterTrait
Tags
Table of Contents
Interfaces
Properties
- $maxBufferLength : int
Methods
- __construct() : mixed
- emit() : bool
- Emits a response for a PHP SAPI environment.
- assertNoPreviousOutput() : void
- Checks to see if content has previously been sent.
- emitBody() : void
- Emit the message body.
- emitBodyRange() : void
- Emit a range of the message body.
- emitHeaders() : void
- Emit response headers.
- emitStatusLine() : void
- Emit the status line.
- filterHeader() : string
- Filter a header name to wordcase
- header() : void
- headersSent() : bool
- parseContentRange() : null|array<string|int, mixed>
- Parse content-range header http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
Properties
$maxBufferLength
private
int
$maxBufferLength
= 8192
Methods
__construct()
public
__construct([int $maxBufferLength = 8192 ]) : mixed
Parameters
- $maxBufferLength : int = 8192
emit()
Emits a response for a PHP SAPI environment.
public
emit(ResponseInterface $response) : bool
Emits the status line and headers via the header() function, and the body content via the output buffer.
Parameters
- $response : ResponseInterface
Return values
boolassertNoPreviousOutput()
Checks to see if content has previously been sent.
private
assertNoPreviousOutput() : void
If either headers have been sent or the output buffer contains content, raises an exception.
Tags
emitBody()
Emit the message body.
private
emitBody(ResponseInterface $response) : void
Parameters
- $response : ResponseInterface
emitBodyRange()
Emit a range of the message body.
private
emitBodyRange(array<string|int, mixed> $range, ResponseInterface $response) : void
Parameters
- $range : array<string|int, mixed>
- $response : ResponseInterface
Tags
emitHeaders()
Emit response headers.
private
emitHeaders(ResponseInterface $response) : void
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
- $response : ResponseInterface
emitStatusLine()
Emit the status line.
private
emitStatusLine(ResponseInterface $response) : void
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
- $response : ResponseInterface
Tags
filterHeader()
Filter a header name to wordcase
private
filterHeader(string $header) : string
Parameters
- $header : string
Return values
stringheader()
private
header(string $headerName, bool $replace, int $statusCode) : void
Parameters
- $headerName : string
- $replace : bool
- $statusCode : int
headersSent()
private
headersSent([string|null &$filename = null ][, int|null &$line = null ]) : bool
Parameters
- $filename : string|null = null
- $line : int|null = null
Return values
boolparseContentRange()
Parse content-range header http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
private
parseContentRange(string $header) : null|array<string|int, mixed>
Parameters
- $header : string
Tags
Return values
null|array<string|int, mixed> —[unit, first, last, length]; returns null if no content range or an invalid content range is provided