Passed
Push — master ( 3aff2b...13d978 )
by Michael
03:06
created

JsonApiResponse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getDocument() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\HttpClient;
5
6
use GuzzleHttp\Psr7\Response;
7
use Mikemirten\Component\JsonApi\Document\AbstractDocument;
8
9
/**
10
 * JsonApi extension of Response
11
 *
12
 * @package Mikemirten\Component\JsonApi\HttpClient
13
 */
14
class JsonApiResponse extends Response
15
{
16
    /**
17
     * @var AbstractDocument
18
     */
19
    protected $document;
20
21
    /**
22
     * JsonApiResponse constructor.
23
     *
24
     * @param int              $status
25
     * @param array            $headers
26
     * @param AbstractDocument $document
27
     */
28 2
    public function __construct($status, array $headers, AbstractDocument $document)
29
    {
30 2
        $this->document = $document;
31
32 2
        parent::__construct($status, $headers);
33 2
    }
34
35
    /**
36
     * Get JsonApi-document
37
     *
38
     * @return AbstractDocument
39
     */
40 2
    public function getDocument(): AbstractDocument
41
    {
42 2
        return $this->document;
43
    }
44
}