1 | <?php namespace CMPayments\JsonLint\Exceptions; |
||
11 | class JsonLintException extends \ErrorException |
||
12 | { |
||
13 | const ERROR_TEMPORARILY_UNAVAILABLE = 1; |
||
14 | const ERROR_LEXICAL_ERROR = 2; |
||
15 | |||
16 | protected $messages = [ |
||
17 | self::ERROR_TEMPORARILY_UNAVAILABLE => 'This Service is temporarily unavailable', |
||
18 | self::ERROR_LEXICAL_ERROR => 'Lexical error on line %d, unrecognized text' |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $args = []; |
||
25 | |||
26 | /** |
||
27 | * @var null |
||
28 | */ |
||
29 | private $jsonLineNo = null; |
||
30 | |||
31 | /** |
||
32 | * @var null |
||
33 | */ |
||
34 | private $jsonColumnNo = null; |
||
35 | |||
36 | /** |
||
37 | * @var null |
||
38 | */ |
||
39 | private $jsonMatch = null; |
||
40 | |||
41 | /** |
||
42 | * @var null |
||
43 | */ |
||
44 | private $jsonToken = null; |
||
45 | |||
46 | /** |
||
47 | * @var null |
||
48 | */ |
||
49 | private $jsonExpected = null; |
||
50 | |||
51 | /** |
||
52 | * @return mixed |
||
53 | */ |
||
54 | public function getArgs() |
||
58 | |||
59 | /** |
||
60 | * @param mixed $args |
||
61 | */ |
||
62 | public function setArgs($args) |
||
63 | { |
||
64 | // check is $args is an array, if not, cast it into an array |
||
65 | if (!is_array($args)) { |
||
66 | |||
67 | $args = [$args]; |
||
68 | } |
||
69 | |||
70 | $this->args = $args; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return null |
||
75 | */ |
||
76 | public function getJsonLineNo() |
||
80 | |||
81 | /** |
||
82 | * @param null $jsonLineNo |
||
83 | */ |
||
84 | public function setJsonLineNo($jsonLineNo) |
||
88 | |||
89 | /** |
||
90 | * @return null |
||
91 | */ |
||
92 | public function getJsonColumnNo() |
||
96 | |||
97 | /** |
||
98 | * @param integer $jsonColumnNo |
||
99 | */ |
||
100 | public function setJsonColumnNo($jsonColumnNo) |
||
104 | |||
105 | /** |
||
106 | * @return null |
||
107 | */ |
||
108 | public function getJsonMatch() |
||
112 | |||
113 | /** |
||
114 | * @param null $jsonMatch |
||
115 | */ |
||
116 | public function setJsonMatch($jsonMatch) |
||
120 | |||
121 | /** |
||
122 | * @return null |
||
123 | */ |
||
124 | public function getJsonToken() |
||
128 | |||
129 | /** |
||
130 | * @param null $jsonToken |
||
131 | */ |
||
132 | public function setJsonToken($jsonToken) |
||
136 | |||
137 | /** |
||
138 | * @return null |
||
139 | */ |
||
140 | public function getJsonExpected() |
||
144 | |||
145 | /** |
||
146 | * @param null $jsonExpected |
||
147 | */ |
||
148 | public function setJsonExpected($jsonExpected) |
||
152 | |||
153 | /** |
||
154 | * @return array |
||
155 | */ |
||
156 | public function getDetails() |
||
157 | { |
||
158 | return [ |
||
159 | 'errorCode' => $this->getCode(), |
||
160 | 'match' => $this->getJsonMatch(), |
||
161 | 'token' => $this->getJsonToken(), |
||
162 | 'line' => $this->getJsonLineNo(), |
||
163 | 'column' => $this->getJsonColumnNo(), |
||
164 | 'expected' => $this->getJsonExpected() |
||
165 | ]; |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * Append the current message with some more text |
||
170 | * |
||
171 | * @param string|null $appendingText |
||
172 | */ |
||
173 | public function appendMessage($appendingText) |
||
177 | |||
178 | /** |
||
179 | * ApiException constructor. |
||
180 | * |
||
181 | * @param string $code |
||
182 | * @param array $args |
||
183 | * @param null $message |
||
184 | */ |
||
185 | public function __construct($code, $args = [], $message = null) |
||
192 | |||
193 | /** |
||
194 | * Retrieves a specific array key from a class constant |
||
195 | * |
||
196 | * @param int $code |
||
197 | * @param string $default |
||
198 | * @param string $msgArray |
||
199 | * |
||
200 | * @return null|string |
||
201 | */ |
||
202 | public function getItemFromVariableArray($code, $default = null, $msgArray = 'messages') |
||
218 | |||
219 | /** |
||
220 | * PHP 5.4 workaround for something like this ClassA::class (which is invalid in PHP5.4) |
||
221 | * |
||
222 | * @return string |
||
223 | */ |
||
224 | static public function getClassName() |
||
228 | } |
||
229 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..