1 | <?php |
||
15 | class Error implements \JsonSerializable |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $id; |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $links = []; |
||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | protected $status; |
||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $code; |
||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $title; |
||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $detail; |
||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $source = []; |
||
45 | /** |
||
46 | * @var mixed |
||
47 | */ |
||
48 | protected $meta; |
||
49 | |||
50 | /** |
||
51 | * @param string $title |
||
52 | * @param string $message |
||
53 | * @param string $code |
||
54 | */ |
||
55 | public function __construct($title, $message, $code = '') |
||
61 | |||
62 | /** |
||
63 | * @param string $key |
||
64 | * @param string $value |
||
65 | * |
||
66 | * @throws \InvalidArgumentException |
||
67 | */ |
||
68 | public function setSource($key, $value) |
||
75 | |||
76 | /** |
||
77 | * A unique identifier for this particular occurrence of the problem. |
||
78 | * |
||
79 | * @param $id |
||
80 | */ |
||
81 | public function setId($id) |
||
85 | |||
86 | /** |
||
87 | * @return int |
||
88 | */ |
||
89 | public function getStatus() |
||
93 | |||
94 | /** |
||
95 | * The HTTP status code applicable to this problem, expressed as a string value. |
||
96 | * |
||
97 | * @param $status |
||
98 | * |
||
99 | * @throws \InvalidArgumentException |
||
100 | */ |
||
101 | public function setStatus($status) |
||
171 | |||
172 | /** |
||
173 | * A short, human-readable summary of the problem that SHOULD NOT change from occurrence to |
||
174 | * occurrence of the problem, except for purposes of localization. |
||
175 | * |
||
176 | * @param string $title |
||
177 | * |
||
178 | * @throws \InvalidArgumentException |
||
179 | */ |
||
180 | protected function setTitle($title) |
||
188 | |||
189 | /** |
||
190 | * A human-readable explanation specific to this occurrence of the problem. |
||
191 | * |
||
192 | * @param $detail |
||
193 | * |
||
194 | * @throws \InvalidArgumentException |
||
195 | */ |
||
196 | protected function setDetail($detail) |
||
204 | |||
205 | /** |
||
206 | * An application-specific error code, expressed as a string value. |
||
207 | * |
||
208 | * @param string $code |
||
209 | */ |
||
210 | public function setCode($code) |
||
214 | |||
215 | /** |
||
216 | * A link that leads to further details about this particular occurrence of the problem. |
||
217 | * |
||
218 | * @param string $link |
||
219 | * |
||
220 | * @throws \InvalidArgumentException |
||
221 | */ |
||
222 | public function setAboutLink($link) |
||
230 | |||
231 | /** |
||
232 | * A meta object containing non-standard meta-information about the error. |
||
233 | * |
||
234 | * @param mixed $meta |
||
235 | */ |
||
236 | public function setMeta($meta) |
||
240 | |||
241 | /** |
||
242 | * {@inheritdoc} |
||
243 | */ |
||
244 | public function jsonSerialize() |
||
259 | } |
||
260 |