ResponseEmitterAbstract
in package
implements
ResponseEmitterInterface
AbstractYes
Tags
Table of Contents
Interfaces
Properties
- $body : StreamInterface
- $bufferSize : int
- $hasContentRange : bool
- $hasCustomLength : bool
- $rangeLength : int
- $rangeStart : int
- $response : ResponseInterface
Methods
- __construct() : mixed
- ResponseEmitter constructor
- emitBody() : void
- emits the body of the given response with respect to the parameters given in content-range and content-length headers
- emitBodyRange() : void
- emits a part of the body
- emitBuffer() : void
- emits the given buffer
- getStatusLine() : string
- Returns a full status line for the given response, e.g. "HTTP/1.1 200 OK"
- hasBody() : bool
- Checks whether the response has (or is supposed to have) a body
- parseContentRange() : array{0: int, 1: int, 2: int|null, 3: int}|null
- setContentLengthHeader() : void
- Sets/adjusts the Content-Length header
Properties
$body
protected
StreamInterface
$body
$bufferSize
protected
int
$bufferSize
= 65536
$hasContentRange
protected
bool
$hasContentRange
$hasCustomLength
protected
bool
$hasCustomLength
$rangeLength
protected
int
$rangeLength
= 0
$rangeStart
protected
int
$rangeStart
= 0
$response
protected
ResponseInterface
$response
Methods
__construct()
ResponseEmitter constructor
public
__construct(ResponseInterface $response[, int $bufferSize = 65536 ]) : mixed
Parameters
- $response : ResponseInterface
- $bufferSize : int = 65536
emitBody()
emits the body of the given response with respect to the parameters given in content-range and content-length headers
protected
emitBody() : void
emitBodyRange()
emits a part of the body
protected
emitBodyRange(int $start, int $length) : void
Parameters
- $start : int
- $length : int
emitBuffer()
emits the given buffer
protected
emitBuffer(string $buffer) : void
Parameters
- $buffer : string
Tags
getStatusLine()
Returns a full status line for the given response, e.g. "HTTP/1.1 200 OK"
protected
getStatusLine() : string
Return values
stringhasBody()
Checks whether the response has (or is supposed to have) a body
protected
hasBody() : bool
Tags
Return values
boolparseContentRange()
protected
parseContentRange() : array{0: int, 1: int, 2: int|null, 3: int}|null
Tags
Return values
array{0: int, 1: int, 2: int|null, 3: int}|nullsetContentLengthHeader()
Sets/adjusts the Content-Length header
protected
setContentLengthHeader() : void
(technically we could do this in a PSR-15 middleware but this class is supposed to work as standalone as well)