Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Emitter
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
10 / 10
n/a
0 / 0
n/a
0 / 0
100.00% covered (success)
100.00%
1 / 1
3
 emit
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Core;
6
7use Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
8use Laminas\HttpHandlerRunner\Emitter\EmitterStack;
9use Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
10use Laminas\HttpHandlerRunner\Emitter\SapiStreamEmitter;
11use Override;
12use Psr\Http\Message\ResponseInterface;
13
14final class Emitter implements EmitterInterface
15{
16    protected EmitterStack $stack;
17
18    public function __construct(int $maxBufferLength = 8192)
19    {
20        $sapiStreamEmitter = new SapiStreamEmitter($maxBufferLength);
21        $conditionalEmitter = new class($sapiStreamEmitter) implements EmitterInterface {
22            private EmitterInterface $emitter;
23
24            public function __construct(EmitterInterface $emitter)
25            {
26                $this->emitter = $emitter;
27            }
28
29            #[Override]
30            public function emit(ResponseInterface $response): bool
31            {
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
33                    return false;
34                }
35
36                return $this->emitter->emit($response);
37            }
38        };
39
40        $this->stack = new EmitterStack();
41        $this->stack->push(new SapiEmitter());
42        $this->stack->push($conditionalEmitter);
43    }
44
45    #[Override]
46    public function emit(ResponseInterface $response): bool
47    {
48        return $this->stack->emit($response);
49    }
50}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Emitter->emit
46    public function emit(ResponseInterface $response): bool
47    {
48        return $this->stack->emit($response);
49    }
Laminas\HttpHandlerRunner\Emitter\EmitterInterface@anonymous
30            public function emit(ResponseInterface $response): bool
31            {
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
33                    return false;
30            public function emit(ResponseInterface $response): bool
31            {
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
36                return $this->emitter->emit($response);
37            }
30            public function emit(ResponseInterface $response): bool
31            {
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
33                    return false;
30            public function emit(ResponseInterface $response): bool
31            {
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
32                if (!$response->hasHeader('Content-Disposition') && !$response->hasHeader('Content-Range')) {
 
36                return $this->emitter->emit($response);
37            }