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

Guzzle   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A request() 0 3 1
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