|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy; |
|
6
|
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation as Serializer; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class Error. |
|
11
|
|
|
* |
|
12
|
|
|
* @Serializer\AccessType("public_method") |
|
13
|
|
|
* |
|
14
|
|
|
* @author Vasil Dakov <[email protected]> |
|
15
|
|
|
* @copyright 2009-2022 Neutrino.bg |
|
16
|
|
|
* |
|
17
|
|
|
* @version 1.0 |
|
18
|
|
|
*/ |
|
19
|
|
|
class Error |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* System generated unique error id to be used as this error reference. |
|
23
|
|
|
* |
|
24
|
|
|
* @Serializer\Type("string") |
|
25
|
|
|
*/ |
|
26
|
|
|
private string $id; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Message context, if associated. This refers to an item that is wrong and should be corrected. |
|
30
|
|
|
* |
|
31
|
|
|
* @Serializer\Type("string") |
|
32
|
|
|
*/ |
|
33
|
|
|
private ?string $context = null; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Error message in language specified in the request. |
|
37
|
|
|
* |
|
38
|
|
|
* @Serializer\Type("string") |
|
39
|
|
|
*/ |
|
40
|
|
|
private string $message; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Error code. See Appendix 3 - Error Codes for more details. |
|
44
|
|
|
* |
|
45
|
|
|
* @Serializer\Type("integer") |
|
46
|
|
|
*/ |
|
47
|
|
|
private int $code; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* The request component, if applicable, relevant to this error in JSONPath format with dot notation. |
|
51
|
|
|
* |
|
52
|
|
|
* @Serializer\Type("string") |
|
53
|
|
|
*/ |
|
54
|
|
|
private ?string $component; |
|
55
|
|
|
|
|
56
|
1 |
|
public function getId(): string |
|
57
|
|
|
{ |
|
58
|
1 |
|
return $this->id; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
1 |
|
public function setId(string $id): void |
|
62
|
|
|
{ |
|
63
|
1 |
|
$this->id = $id; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
1 |
|
public function getContext(): ?string |
|
67
|
|
|
{ |
|
68
|
1 |
|
return $this->context; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
1 |
|
public function setContext(?string $context): void |
|
72
|
|
|
{ |
|
73
|
1 |
|
$this->context = $context; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
1 |
|
public function getMessage(): string |
|
77
|
|
|
{ |
|
78
|
1 |
|
return $this->message; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
1 |
|
public function setMessage(string $message): void |
|
82
|
|
|
{ |
|
83
|
1 |
|
$this->message = $message; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
1 |
|
public function getCode(): int |
|
87
|
|
|
{ |
|
88
|
1 |
|
return $this->code; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
1 |
|
public function setCode(int $code): void |
|
92
|
|
|
{ |
|
93
|
1 |
|
$this->code = $code; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
1 |
|
public function getComponent(): ?string |
|
97
|
|
|
{ |
|
98
|
1 |
|
return $this->component; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
1 |
|
public function setComponent(?string $component): void |
|
102
|
|
|
{ |
|
103
|
1 |
|
$this->component = $component; |
|
104
|
|
|
} |
|
105
|
|
|
} |
|
106
|
|
|
|