Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function validate($value): Result |
||
36 | { |
||
37 | $numericResult = (new Numeric())->validate($value); |
||
38 | |||
39 | if (!$numericResult->isValid()) |
||
40 | return new $numericResult; |
||
41 | |||
42 | if ($value >= $this->min) |
||
43 | return new Success(); |
||
44 | |||
45 | return new Failure(new RuleError(RuleErrorCode::LESS_THAN_MINIMUM, |
||
46 | 'The supplied number is less than the minimum value')); |
||
47 | } |
||
48 | } |