Conditions | 6 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | 40 | private function preValidate( |
|
17 | $value, |
||
18 | ValidationContext $context, |
||
19 | BeforeValidationInterface $rule |
||
20 | ): bool { |
||
21 | 40 | if ($rule->shouldSkipOnEmpty() && $this->isEmpty($value)) { |
|
22 | 2 | return true; |
|
23 | } |
||
24 | |||
25 | 38 | if ($rule->shouldSkipOnError() && $context->getParameter($this->parameterPreviousRulesErrored) === true) { |
|
26 | 1 | return true; |
|
27 | } |
||
28 | |||
29 | 37 | return is_callable($rule->getWhen()) && !($rule->getWhen())($value, $context); |
|
30 | } |
||
32 |