Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Guzzle | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
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 GuzzleHttp\Psr7\HttpFactory; |
| 9 | use GuzzleHttp\Psr7\ServerRequest; |
| 10 | use Override; |
| 11 | use Psr\Http\Message\ServerRequestInterface; |
| 12 | use Throwable; |
| 13 | |
| 14 | /** @api */ |
| 15 | class Guzzle extends AbstractFactory |
| 16 | { |
| 17 | public function __construct() |
| 18 | { |
| 19 | try { |
| 20 | $factory = new HttpFactory(); |
| 21 | $this->responseFactory = $factory; |
| 22 | $this->streamFactory = $factory; |
| 23 | $this->requestFactory = $factory; |
| 24 | $this->serverRequestFactory = $factory; |
| 25 | $this->uploadedFileFactory = $factory; |
| 26 | $this->uriFactory = $factory; |
| 27 | |
| 28 | // @codeCoverageIgnoreStart |
| 29 | } catch (Throwable) { |
| 30 | throw new RuntimeException('Install guzzlehttp/psr7'); |
| 31 | |
| 32 | // @codeCoverageIgnoreEnd |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | #[Override] |
| 37 | public function serverRequest(): ServerRequestInterface |
| 38 | { |
| 39 | return ServerRequest::fromGlobals(); |
| 40 | } |
| 41 | } |
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.
| 19 | try { |
| 20 | $factory = new HttpFactory(); |
| 21 | $this->responseFactory = $factory; |
| 22 | $this->streamFactory = $factory; |
| 23 | $this->requestFactory = $factory; |
| 24 | $this->serverRequestFactory = $factory; |
| 25 | $this->uploadedFileFactory = $factory; |
| 26 | $this->uriFactory = $factory; |
| 34 | } |
| 39 | return ServerRequest::fromGlobals(); |
| 40 | } |