Fr3nch13/CakePHP Utilities

SapiEmitter
in package
implements EmitterInterface uses SapiEmitterTrait

Table of Contents

Interfaces

EmitterInterface

Methods

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.
emitHeaders()  : void
Emit response headers.
emitStatusLine()  : void
Emit the status line.
filterHeader()  : string
Filter a header name to wordcase
header()  : void
headersSent()  : bool

Methods

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
bool

assertNoPreviousOutput()

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
throws
EmitterException

If headers have already been sent.

throws
EmitterException

If output is present in the output buffer.

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
see
SapiEmitterTrait::emitHeaders()

filterHeader()

Filter a header name to wordcase

private filterHeader(string $header) : string
Parameters
$header : string
Return values
string

header()

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
bool

        
On this page

Search results