1 | <?php |
||
14 | abstract class AbstractError implements ResponseModelInterface |
||
15 | { |
||
16 | private $id; |
||
17 | private $link; |
||
18 | private $httpStatusCode; |
||
19 | private $code; |
||
20 | private $title; |
||
21 | private $description; |
||
22 | private $source; |
||
23 | private $meta; |
||
24 | |||
25 | /** |
||
26 | * @param string $title a short, human-readable summary of the problem that SHOULD NOT change from occurrence |
||
27 | * to occurrence of the problem, except for purposes of localization |
||
28 | * @param int $httpStatusCode the HTTP status code applicable to this problem, expressed as a string value |
||
29 | */ |
||
30 | 9 | public function __construct(string $title, int $httpStatusCode) |
|
35 | |||
36 | public function getHttpStatusCode(): int |
||
40 | |||
41 | /** |
||
42 | * A unique identifier for this particular occurrence of the problem. |
||
43 | */ |
||
44 | public function setId(string $id): void |
||
48 | |||
49 | /** |
||
50 | * A link that leads to further details about this particular occurrence of the problem. |
||
51 | */ |
||
52 | public function setLink(string $link): void |
||
56 | |||
57 | /** |
||
58 | * An application-specific error code, expressed as a string value. |
||
59 | */ |
||
60 | public function setCode(string $code): void |
||
64 | |||
65 | /** |
||
66 | * A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized. |
||
67 | */ |
||
68 | public function setDescription(string $description): void |
||
72 | |||
73 | /** |
||
74 | * An object containing references to the source of the error. |
||
75 | * |
||
76 | * May include the following keys: |
||
77 | * - parameter: a string indicating which URI query parameter caused the error. |
||
78 | * - pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary |
||
79 | * data object, or "/data/attributes/title" for a specific attribute]. |
||
80 | */ |
||
81 | 1 | public function setSource(array $source): void |
|
85 | |||
86 | /** |
||
87 | * a meta object containing non-standard meta-information about the error. |
||
88 | * |
||
89 | * @see https://jsonapi.org/format/#document-meta |
||
90 | */ |
||
91 | public function setMeta(array $meta): void |
||
95 | |||
96 | public function getPayload(): array |
||
102 | |||
103 | /** |
||
104 | * Get the error object. |
||
105 | */ |
||
106 | 7 | public function getErrorData(): array |
|
139 | } |
||
140 |