Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function validate($value): Result |
||
27 | { |
||
28 | $numericResult = (new Numeric())->validate($value); |
||
29 | |||
30 | if (!$numericResult->isValid()) |
||
31 | return new $numericResult; |
||
32 | |||
33 | if ($value > 0) |
||
34 | return new Success(); |
||
35 | |||
36 | return new Failure(new RuleError(RuleErrorCode::NOT_POSITIVE, 'The supplied number is not positive')); |
||
37 | } |
||
38 | } |