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

Laminas   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A request() 0 3 1
A __construct() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Chuck\Psr;
6
7
use Conia\Chuck\Exception\RuntimeException;
8
use Laminas\Diactoros\ResponseFactory;
9
use Laminas\Diactoros\ServerRequestFactory;
10
use Laminas\Diactoros\StreamFactory;
11
use Psr\Http\Message\ServerRequestInterface as PsrServerRequest;
12
use Throwable;
13
14
class Laminas extends AbstractFactory
15
{
16 3
    public function __construct()
17
    {
18
        try {
19 3
            $this->responseFactory = new ResponseFactory();
20 3
            $this->streamFactory = new StreamFactory();
21
            // @codeCoverageIgnoreStart
22
        } catch (Throwable) {
23
            throw new RuntimeException('Install nyholm/psr7-server');
24
            // @codeCoverageIgnoreEnd
25
        }
26
    }
27
28 2
    public function request(): PsrServerRequest
29
    {
30 2
        return ServerRequestFactory::fromGlobals();
31
    }
32
}
33