1 | <?php |
||
9 | class ApiException extends Exception |
||
10 | { |
||
11 | const INVALID_REQUEST = 'invalid_request'; |
||
12 | const INVALID_PARAMETERS = 'invalid_parameters'; |
||
13 | const INVALID_STATE = 'invalid_state'; |
||
14 | const INVALID_GRANT = 'invalid_grant'; |
||
15 | const INVALID_CODE = 'invalid_code'; |
||
16 | const UNAUTHORIZED = 'unauthorized'; |
||
17 | const FORBIDDEN = 'forbidden'; |
||
18 | const NOT_FOUND = 'not_found'; |
||
19 | const RATE_LIMIT_EXCEEDED = 'rate_limit_exceeded'; |
||
20 | const INTERNAL_SERVER_ERROR = 'internal_server_error'; |
||
21 | const NOT_ACCEPTABLE = 'not_acceptable'; |
||
22 | const OFFSET_TOO_LARGE = 'offset_too_large'; |
||
23 | const INVALID_CURSOR = 'invalid_cursor'; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $errorCode; |
||
29 | |||
30 | /** |
||
31 | * @var int|null |
||
32 | */ |
||
33 | private $statusCode; |
||
34 | |||
35 | /** |
||
36 | * @var array|null |
||
37 | */ |
||
38 | private $properties; |
||
39 | |||
40 | /** |
||
41 | * @var array|null |
||
42 | */ |
||
43 | private $data; |
||
44 | |||
45 | /** |
||
46 | * @var Violation[] |
||
47 | */ |
||
48 | private $violations; |
||
49 | |||
50 | /** |
||
51 | * @param string $errorCode |
||
52 | * @param string|null $message |
||
53 | * @param int|null $statusCode |
||
54 | * @param Exception|null $previous |
||
55 | * @param array|null $properties |
||
56 | * @param array|null $data |
||
57 | * @param array $violations |
||
58 | */ |
||
59 | 41 | public function __construct( |
|
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | 30 | public function getErrorCode() |
|
84 | |||
85 | /** |
||
86 | * @return int|null |
||
87 | */ |
||
88 | 30 | public function getStatusCode() |
|
92 | |||
93 | /** |
||
94 | * @param array|null $properties |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setProperties($properties) |
||
103 | |||
104 | /** |
||
105 | * @return array|null |
||
106 | */ |
||
107 | 30 | public function getProperties() |
|
111 | |||
112 | /** |
||
113 | * @param array|null $data |
||
114 | * |
||
115 | * @return $this |
||
116 | */ |
||
117 | public function setData($data) |
||
122 | |||
123 | /** |
||
124 | * @return array|null |
||
125 | */ |
||
126 | 30 | public function getData() |
|
130 | |||
131 | /** |
||
132 | * @return Violation[] |
||
133 | */ |
||
134 | 30 | public function getViolations() |
|
138 | |||
139 | /** |
||
140 | * @param Violation[] $violations |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | 19 | public function setViolations($violations) |
|
149 | } |
||
150 |