| Conditions | 8 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 8 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 124 | private function preValidate( |
|
| 19 | $value, |
||
| 20 | ValidationContext $context, |
||
| 21 | RuleInterface $rule |
||
| 22 | ): bool { |
||
| 23 | if ( |
||
| 24 | 124 | $rule instanceof SkipOnEmptyInterface && |
|
| 25 | 124 | (SkipOnEmptyNormalizer::normalize($rule->getSkipOnEmpty()))($value, $context->isAttributeMissing()) |
|
| 26 | ) { |
||
| 27 | 22 | return true; |
|
| 28 | } |
||
| 29 | |||
| 30 | if ( |
||
| 31 | 119 | $rule instanceof SkipOnErrorInterface |
|
| 32 | 119 | && $rule->shouldSkipOnError() |
|
| 33 | 119 | && $context->getParameter($this->parameterPreviousRulesErrored) === true |
|
| 34 | ) { |
||
| 35 | 4 | return true; |
|
| 36 | } |
||
| 37 | |||
| 38 | 118 | if ($rule instanceof WhenInterface) { |
|
| 39 | 115 | return ($rule->getWhen() !== null) && !($rule->getWhen())($value, $context); |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | return false; |
|
| 43 | } |
||
| 45 |