Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class PaystackValidationException extends PaystackException |
||
11 | { |
||
12 | /** @var array<string, string> */ |
||
13 | protected array $errors = []; |
||
14 | |||
15 | /** |
||
16 | * @param array<string, string> $errors |
||
17 | */ |
||
18 | public function __construct( |
||
19 | string $message = '', |
||
20 | array $errors = [], |
||
21 | int $code = 0, |
||
22 | ?Exception $previous = null |
||
23 | ) { |
||
24 | parent::__construct($message, $code, $previous); |
||
25 | $this->errors = $errors; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @return array<string, string> |
||
30 | */ |
||
31 | public function getErrors(): array |
||
34 | } |
||
35 | |||
36 | public function addError(string $field, string $message): self |
||
37 | { |
||
38 | $this->errors[$field] = $message; |
||
39 | |||
40 | return $this; |
||
41 | } |
||
42 | |||
43 | public function hasErrors(): bool |
||
46 | } |
||
47 | } |
||
48 |