Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Laminas | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| serverRequest | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Core\Factory; |
| 6 | |
| 7 | use Celemas\Core\Exception\RuntimeException; |
| 8 | use Laminas\Diactoros\RequestFactory; |
| 9 | use Laminas\Diactoros\ResponseFactory; |
| 10 | use Laminas\Diactoros\ServerRequestFactory; |
| 11 | use Laminas\Diactoros\StreamFactory; |
| 12 | use Laminas\Diactoros\UploadedFileFactory; |
| 13 | use Laminas\Diactoros\UriFactory; |
| 14 | use Override; |
| 15 | use Psr\Http\Message\ServerRequestInterface; |
| 16 | use Throwable; |
| 17 | |
| 18 | /** @api */ |
| 19 | class Laminas extends AbstractFactory |
| 20 | { |
| 21 | public function __construct() |
| 22 | { |
| 23 | try { |
| 24 | $this->requestFactory = new RequestFactory(); |
| 25 | $this->responseFactory = new ResponseFactory(); |
| 26 | $this->serverRequestFactory = new ServerRequestFactory(); |
| 27 | $this->streamFactory = new StreamFactory(); |
| 28 | $this->uploadedFileFactory = new UploadedFileFactory(); |
| 29 | $this->uriFactory = new UriFactory(); |
| 30 | |
| 31 | // @codeCoverageIgnoreStart |
| 32 | } catch (Throwable) { |
| 33 | throw new RuntimeException('Install nyholm/psr7-server'); |
| 34 | |
| 35 | // @codeCoverageIgnoreEnd |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | #[Override] |
| 40 | public function serverRequest(): ServerRequestInterface |
| 41 | { |
| 42 | return ServerRequestFactory::fromGlobals(); |
| 43 | } |
| 44 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 23 | try { |
| 24 | $this->requestFactory = new RequestFactory(); |
| 25 | $this->responseFactory = new ResponseFactory(); |
| 26 | $this->serverRequestFactory = new ServerRequestFactory(); |
| 27 | $this->streamFactory = new StreamFactory(); |
| 28 | $this->uploadedFileFactory = new UploadedFileFactory(); |
| 29 | $this->uriFactory = new UriFactory(); |
| 37 | } |
| 42 | return ServerRequestFactory::fromGlobals(); |
| 43 | } |