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

Guzzle5RequestAdapter   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMethod() 0 4 1
A getUri() 0 4 1
A getContent() 0 6 2
A getHeader() 0 6 2
1
<?php declare(strict_types=1);
2
3
namespace Starlit\Request\Authenticator\Hmac\Adapter;
4
5
use GuzzleHttp\Message\Request;
6
7
class Guzzle5RequestAdapter implements RequestAdapterInterface
8
{
9
    /**
10
     * @var Request
11
     */
12
    private $request;
13
14 1
    public function __construct(Request $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->getUrl();
27
    }
28
29 1
    public function getContent(): string
30
    {
31 1
        $body = $this->request->getBody();
32
33 1
        return isset($body) ? $body->__toString() : '';
34
    }
35
36 1
    public function getHeader(string $key): ?string
37
    {
38 1
        $header = $this->request->getHeader($key);
39
40 1
        return !empty($header) ? $header : null;
41
    }
42
}
43