| Total Complexity | 9 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class Emitter implements EmitterInterface |
||
| 12 | { |
||
| 13 | public function __construct( |
||
| 14 | private Response $response, |
||
| 15 | private int $bufferSize = 8_388_608, // 8MB |
||
|
|
|||
| 16 | ) { |
||
| 17 | } |
||
| 18 | |||
| 19 | public function withBufferSize(int $size) |
||
| 20 | { |
||
| 21 | $new = clone $this; |
||
| 22 | $new->bufferSize = $size; |
||
| 23 | |||
| 24 | return $new; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getBufferSize(): int |
||
| 28 | { |
||
| 29 | return $this->bufferSize; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function emit(ResponseInterface $response, bool $withoutBody = false) |
||
| 45 | } |
||
| 46 | |||
| 47 | private function emitBody(StreamInterface $body): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |