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