Final Class Yiisoft\PsrEmitter\SapiEmitter
| Inheritance | Yiisoft\PsrEmitter\SapiEmitter |
|---|---|
| Implements | Yiisoft\PsrEmitter\EmitterInterface |
SapiEmitter sends a response using standard PHP Server API, i.e., with {@see header()} and "echo".
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\PsrEmitter\SapiEmitter | |
| emit() | Yiisoft\PsrEmitter\SapiEmitter |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| DEFAULT_BUFFER_SIZE | 8388608 | Yiisoft\PsrEmitter\SapiEmitter |
Method Details
| public mixed __construct ( integer|null $bufferSize = null ) | ||
| $bufferSize | integer|null |
The size of the buffer in bytes to send the content of the message body. |
public function __construct(?int $bufferSize = null)
{
if ($bufferSize !== null && $bufferSize < 1) {
throw new InvalidArgumentException('Buffer size must be greater than zero.');
}
$this->bufferSize = $bufferSize ?? self::DEFAULT_BUFFER_SIZE;
}
| public void emit ( \Psr\Http\Message\ResponseInterface $response ) | ||
| $response | \Psr\Http\Message\ResponseInterface | |
public function emit(ResponseInterface $response): void
{
$this->emitHeaders($response);
/**
* Sends headers before the body.
* Makes a client possible to recognize the type of the body content if it is sent with a delay,
* for instance, for a streamed response.
*/
flush();
$this->emitBody($response);
}
Signup or Login in order to comment.