| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class GreaterThan implements Rule |
||
| 14 | { |
||
| 15 | protected float $number; |
||
| 16 | |||
| 17 | public function __construct(float $number) |
||
| 18 | { |
||
| 19 | $this->number = $number; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @inheritdoc |
||
| 24 | */ |
||
| 25 | public function validate(string $name, $value) |
||
| 26 | { |
||
| 27 | if ($value <= $this->number) { |
||
| 28 | throw new ValidationException($this->message($name)); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Generate error message |
||
| 34 | */ |
||
| 35 | protected function message(string $name): string |
||
| 38 | } |
||
| 39 | } |
||
| 40 |