Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
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->max) |
||
43 | return new Success(); |
||
44 | |||
45 | return new Failure(new RuleError(RuleErrorCode::EXCEEDS_MAXIMUM, 'The supplied number exceeds the maximum value')); |
||
46 | } |
||
47 | } |