Guzzle::request()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
/** @psalm-api */
14
class Guzzle extends AbstractFactory
15
{
16 3
    public function __construct()
17
    {
18
        try {
19 3
            $this->streamFactory = $this->responseFactory = new HttpFactory();
20
            // @codeCoverageIgnoreStart
21
        } catch (Throwable) {
22
            throw new RuntimeException('Install guzzlehttp/psr7');
23
            // @codeCoverageIgnoreEnd
24
        }
25
    }
26
27 2
    public function request(): PsrServerRequest
28
    {
29 2
        return ServerRequest::fromGlobals();
30
    }
31
}
32