| Total Lines | 27 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 14 | public function __construct(int $maxBufferLength = 8192) |
|
| 18 | { |
||
| 19 | 14 | $sapiStreamEmitter = new SapiStreamEmitter($maxBufferLength); |
|
| 20 | 14 | $conditionalEmitter = new class ($sapiStreamEmitter) implements EmitterInterface { |
|
| 21 | private $emitter; |
||
| 22 | |||
| 23 | public function __construct(EmitterInterface $emitter) |
||
| 24 | { |
||
| 25 | 14 | $this->emitter = $emitter; |
|
| 26 | } |
||
| 27 | |||
| 28 | public function emit(ResponseInterface $response): bool |
||
| 29 | { |
||
| 30 | if ( |
||
| 31 | 14 | !$response->hasHeader('Content-Disposition') |
|
| 32 | 14 | && !$response->hasHeader('Content-Range') |
|
| 33 | ) { |
||
| 34 | 13 | return false; |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | return $this->emitter->emit($response); |
|
| 38 | } |
||
| 39 | 14 | }; |
|
| 40 | |||
| 41 | 14 | $this->stack = new EmitterStack(); |
|
| 42 | 14 | $this->stack->push(new SapiEmitter()); |
|
| 43 | 14 | $this->stack->push($conditionalEmitter); |
|
| 44 | } |
||
| 51 |