Conditions | 7 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | private function preValidate( |
||
17 | $value, |
||
18 | ValidationContext $context, |
||
19 | bool $skipOnEmpty, |
||
20 | bool $skipOnError, |
||
21 | Closure $when, |
||
22 | ) { |
||
23 | if ($skipOnEmpty && $this->isEmpty($value)) { |
||
24 | return new Result(); |
||
25 | } |
||
26 | |||
27 | if ($skipOnError && $context->getParameter(Validator::PARAMETER_PREVIOUS_RULES_ERRORED) === true) { |
||
28 | return new Result(); |
||
29 | } |
||
30 | |||
31 | if (is_callable($when) && !($when)($value, $context)) { |
||
32 | return new Result(); |
||
33 | } |
||
34 | |||
35 | return null; |
||
36 | } |
||
38 |