1 | <?php |
||
2 | |||
3 | namespace GloBee\PaymentApi\Exceptions\Validation; |
||
4 | |||
5 | class InvalidSelectionException extends ValidationException |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | private $options; |
||
11 | |||
12 | /** |
||
13 | * InvalidSelectionException constructor. |
||
14 | * |
||
15 | * @param string $field |
||
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
![]() |
|||
16 | * @param mixed $value |
||
0 ignored issues
–
show
|
|||
17 | * @param array $options |
||
0 ignored issues
–
show
|
|||
18 | */ |
||
19 | 1 | public function __construct($field, $value, array $options) |
|
0 ignored issues
–
show
|
|||
20 | { |
||
21 | 1 | $this->options = $options; |
|
22 | 1 | $message = sprintf('The selected %s is invalid.', $field); |
|
23 | $error = [ |
||
24 | 1 | 'type' => 'invalid_selection', |
|
25 | 1 | 'extra' => $options, |
|
26 | 1 | 'field' => $field, |
|
27 | 1 | 'message' => $message, |
|
28 | ]; |
||
29 | 1 | parent::__construct([$error], $message); |
|
30 | 1 | } |
|
31 | |||
32 | /** |
||
33 | * @return array |
||
34 | */ |
||
35 | 1 | public function getValidOptions() |
|
36 | { |
||
37 | 1 | return $this->options; |
|
38 | } |
||
39 | } |
||
40 |