1 | <?php |
||
25 | class ErrorResource extends AbstractResourceSupport implements ErrorResourceInterface |
||
26 | { |
||
27 | /** |
||
28 | * The identifier of error. |
||
29 | * Can use for multiple errors for split errors. |
||
30 | * |
||
31 | * @var string|int |
||
32 | */ |
||
33 | private $identifier; |
||
34 | |||
35 | /** |
||
36 | * The reason of error. |
||
37 | * |
||
38 | * @var string|int |
||
39 | */ |
||
40 | private $reason; |
||
41 | |||
42 | /** |
||
43 | * The custom message of error. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private $message; |
||
48 | |||
49 | /** |
||
50 | * The custom attributes for this error. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private $attributes; |
||
55 | |||
56 | /** |
||
57 | * The path of this error. |
||
58 | * As an example: the name of invalid form field. |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | private $path; |
||
63 | |||
64 | /** |
||
65 | * Constructor. |
||
66 | * |
||
67 | * @param string $message |
||
68 | * @param string|int $reason |
||
69 | * @param string $path |
||
70 | * @param array $attributes |
||
71 | * @param string|int $identifier |
||
72 | */ |
||
73 | 16 | public function __construct(string $message, $reason = null, string $path = null, array $attributes = [], $identifier = null) |
|
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | 6 | public function getMessage(): string |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 5 | public function getReason() |
|
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | 5 | public function getIdentifier() |
|
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | 5 | public function getPath(): ?string |
|
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | 4 | public function getAttributes(): array |
|
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | 1 | public function addHelp(HrefInterface $href): void |
|
133 | } |
||
134 |