GloBee-Official /
payment-api-php
| 1 | <?php |
||
| 2 | |||
| 3 | namespace GloBee\PaymentApi\Exceptions\Validation; |
||
| 4 | |||
| 5 | class BelowMinimumException extends ValidationException |
||
| 6 | { |
||
| 7 | private $minimum; |
||
|
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
Loading history...
|
|||
| 8 | |||
| 9 | /** |
||
| 10 | * BelowMinimumException constructor. |
||
| 11 | * |
||
| 12 | * @param string $field |
||
|
0 ignored issues
–
show
|
|||
| 13 | * @param mixed $value |
||
|
0 ignored issues
–
show
|
|||
| 14 | * @param int $minimum |
||
|
0 ignored issues
–
show
|
|||
| 15 | */ |
||
| 16 | 3 | public function __construct($field, $value, $minimum) |
|
|
0 ignored issues
–
show
|
|||
| 17 | { |
||
| 18 | 3 | $this->minimum = $minimum; |
|
| 19 | 3 | $message = sprintf('The %s must be at least %.2f', $field, $minimum); |
|
| 20 | $error = [ |
||
| 21 | 3 | 'type' => 'below_minimum', |
|
| 22 | 3 | 'extra' => [$minimum], |
|
| 23 | 3 | 'field' => $field, |
|
| 24 | 3 | 'message' => $message, |
|
| 25 | ]; |
||
| 26 | 3 | parent::__construct([$error], $message); |
|
| 27 | 3 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * @return mixed |
||
| 31 | */ |
||
| 32 | 1 | public function getMinimum() |
|
| 33 | { |
||
| 34 | 1 | return $this->minimum; |
|
| 35 | } |
||
| 36 | } |
||
| 37 |