Class ResponseEmitter
Emits a Response to the PHP Server API.
Property Summary
- 
        $maxBufferLength protectedintMaximum output buffering size for each iteration. 
Method Summary
- 
          __construct() publicConstructor 
- 
          emit() publicEmit a response. 
- 
          emitBody() protectedEmit the message body. 
- 
          emitBodyRange() protectedEmit a range of the message body. 
- 
          emitCookies() protectedEmit cookies using setcookie() 
- 
          emitHeaders() protectedEmit response headers. 
- 
          emitStatusLine() protectedEmit the status line. 
- 
          flush() protectedLoops through the output buffer, flushing each, before emitting the response. 
- 
          parseContentRange() protectedParse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16 
- 
          setCookie() protectedHelper methods to set cookie. 
Method Detail
__construct() ¶ public
__construct(int $maxBufferLength = 8192)Constructor
Parameters
- 
                int$maxBufferLength optional
- Maximum output buffering size for each iteration. 
emit() ¶ public
emit(Psr\Http\Message\ResponseInterface $response): boolEmit a response.
Emits a response, including status line, headers, and the message body, according to the environment.
Parameters
- 
                Psr\Http\Message\ResponseInterface$response
- The response to emit. 
Returns
boolemitBody() ¶ protected
emitBody(Psr\Http\Message\ResponseInterface $response): voidEmit the message body.
Parameters
- 
                Psr\Http\Message\ResponseInterface$response
- The response to emit 
Returns
voidemitBodyRange() ¶ protected
emitBodyRange(array $range, Psr\Http\Message\ResponseInterface $response): voidEmit a range of the message body.
Parameters
- 
                array$range
- The range data to emit 
- 
                Psr\Http\Message\ResponseInterface$response
- The response to emit 
Returns
voidemitCookies() ¶ protected
emitCookies(array<Cake\Http\Cookie\CookieInterface|string> $cookies): voidEmit cookies using setcookie()
Parameters
- 
                array<Cake\Http\Cookie\CookieInterface|string>$cookies
- An array of cookies. 
Returns
voidemitHeaders() ¶ protected
emitHeaders(Psr\Http\Message\ResponseInterface $response): voidEmit 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
- The response to emit 
Returns
voidemitStatusLine() ¶ protected
emitStatusLine(Psr\Http\Message\ResponseInterface $response): voidEmit 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.
Parameters
- 
                Psr\Http\Message\ResponseInterface$response
- The response to emit 
Returns
voidflush() ¶ protected
flush(int|null $maxBufferLevel = null): voidLoops through the output buffer, flushing each, before emitting the response.
Parameters
- 
                int|null$maxBufferLevel optional
- Flush up to this buffer level. 
Returns
voidparseContentRange() ¶ protected
parseContentRange(string $header): array|falseParse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
Parameters
- 
                string$header
- The Content-Range header to parse. 
Returns
array|false[unit, first, last, length]; returns false if no content range or an invalid content range is provided
setCookie() ¶ protected
setCookie(Cake\Http\Cookie\CookieInterface|string $cookie): boolHelper methods to set cookie.
Parameters
- 
                Cake\Http\Cookie\CookieInterface|string$cookie
- Cookie. 
Returns
bool