Completed
Push — 1.0.x-dev ( 34a83d...bde745 )
by Felix
18s queued 11s
created

Psr7RequestAdapter::getHeader()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Starlit\Request\Authenticator\Hmac\Adapter;
4
5
use Psr\Http\Message\RequestInterface;
6
7
class Psr7RequestAdapter implements RequestAdapterInterface
8
{
9
    /**
10
     * @var RequestInterface
11
     */
12
    private $request;
13
14 1
    public function __construct(RequestInterface $request)
15
    {
16 1
        $this->request = $request;
17 1
    }
18
19 1
    public function getMethod(): string
20
    {
21 1
        return $this->request->getMethod();
22
    }
23
24 1
    public function getUri(): string
25
    {
26 1
        return $this->request->getUri()->__toString();
27
    }
28
29 1
    public function getContent(): string
30
    {
31 1
        return $this->request->getBody()->__toString();
32
    }
33
34 1
    public function getHeader(string $key): ?string
35
    {
36 1
        $header = $this->request->getHeaderLine($key);
37
38 1
        return !empty($header) ? $header : null;
39
    }
40
}
41