| Conditions | 8 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 8 |
| Changes | 2 | ||
| 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 | $when = $rule->getWhen(); |
|
| 40 | 115 | return $when !== null && !$when($value, $context); |
|
| 41 | } |
||
| 42 | |||
| 43 | 3 | return false; |
|
| 44 | } |
||
| 46 |