Passed
Push — main ( a1a461...2097df )
by Thomas
12:50
created

Guzzle::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Chuck\Psr;
6
7
use Conia\Chuck\Exception\RuntimeException;
8
use GuzzleHttp\Psr7\HttpFactory;
9
use GuzzleHttp\Psr7\ServerRequest;
10
use Psr\Http\Message\ServerRequestInterface as PsrServerRequest;
11
use Throwable;
12
13
class Guzzle extends AbstractFactory
14
{
15 3
    public function __construct()
16
    {
17
        try {
18 3
            $this->streamFactory = $this->responseFactory = new HttpFactory();
19
            // @codeCoverageIgnoreStart
20
        } catch (Throwable) {
21
            throw new RuntimeException('Install guzzlehttp/psr7');
22
            // @codeCoverageIgnoreEnd
23
        }
24
    }
25
26 2
    public function request(): PsrServerRequest
27
    {
28 2
        return ServerRequest::fromGlobals();
29
    }
30
}
31