Completed
Pull Request — master (#54)
by Jasper
04:00
created

InvalidResponseDocument::setResponse()   A

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
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Swis\JsonApi\Client;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Swis\JsonApi\Client\Interfaces\DocumentInterface;
7
8
class InvalidResponseDocument implements DocumentInterface
9
{
10
    /**
11
     * @var \Psr\Http\Message\ResponseInterface|null
12
     */
13
    protected $response;
14
15
    /**
16
     * @return \Psr\Http\Message\ResponseInterface|null
17
     */
18 5
    public function getResponse(): ? ResponseInterface
19
    {
20 5
        return $this->response;
21
    }
22
23
    /**
24
     * @param \Psr\Http\Message\ResponseInterface|null $response
25
     */
26 5
    public function setResponse(ResponseInterface $response = null)
27
    {
28 5
        $this->response = $response;
29 5
    }
30
31
    /**
32
     * @return \Swis\JsonApi\Client\Interfaces\DataInterface
33
     */
34
    public function getData()
35
    {
36
        return null;
37
    }
38
39
    /**
40
     * @return \Swis\JsonApi\Client\ErrorCollection
41
     */
42
    public function getErrors(): ErrorCollection
43
    {
44
        return new ErrorCollection();
45
    }
46
47
    /**
48
     * @return bool
49
     */
50
    public function hasErrors(): bool
51
    {
52
        return false;
53
    }
54
55
    /**
56
     * @return \Swis\JsonApi\Client\Meta|null
57
     */
58
    public function getMeta(): ? Meta
59
    {
60
        return null;
61
    }
62
63
    /**
64
     * @return \Swis\JsonApi\Client\Links|null
65
     */
66
    public function getLinks(): ? Links
67
    {
68
        return null;
69
    }
70
71
    /**
72
     * @return mixed
73
     */
74
    public function getIncluded(): Collection
75
    {
76
        return new Collection();
77
    }
78
79
    /**
80
     * @return \Swis\JsonApi\Client\Jsonapi|null
81
     */
82
    public function getJsonapi(): ? Jsonapi
83
    {
84
        return null;
85
    }
86
87
    /**
88
     * Specify data which should be serialized to JSON.
89
     *
90
     * @see  http://php.net/manual/en/jsonserializable.jsonserialize.php
91
     *
92
     * @return mixed data which can be serialized by <b>json_encode</b>,
93
     *               which is a value of any type other than a resource
94
     *
95
     * @since 5.4.0
96
     */
97
    public function jsonSerialize()
98
    {
99
        return $this->toArray();
100
    }
101
102
    /**
103
     * @return array
104
     */
105
    public function toArray(): array
106
    {
107
        return [];
108
    }
109
}
110