1 | <?php |
||
10 | class ValidationException extends RuntimeException |
||
11 | { |
||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | private $statusCode; |
||
16 | |||
17 | /** |
||
18 | * @var Error[] |
||
19 | */ |
||
20 | private $errors; |
||
21 | |||
22 | /** |
||
23 | * ValidationException constructor. |
||
24 | * |
||
25 | * Exception thrown when the moip API returns a 4xx http code. |
||
26 | * Indicates that an invalid value was passed. |
||
27 | * |
||
28 | * @param int $statusCode |
||
29 | * @param Error[] $errors |
||
30 | */ |
||
31 | public function __construct($statusCode, $errors) |
||
36 | |||
37 | /** |
||
38 | * Returns the http status code ie.: 400. |
||
39 | * |
||
40 | * @return int |
||
41 | */ |
||
42 | public function getStatusCode() |
||
46 | |||
47 | /** |
||
48 | * Returns the list of errors returned by the API. |
||
49 | * |
||
50 | * @return Error[] |
||
51 | * |
||
52 | * @see \Moip\Exceptions\Error |
||
53 | */ |
||
54 | public function getErrors() |
||
58 | |||
59 | /** |
||
60 | * Convert error variables in string. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function __toString() |
||
77 | } |
||
78 |