| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | public function check($value): bool |
||
| 38 | { |
||
| 39 | 2 | $this->requireParameters(['field', 'values']); |
|
| 40 | |||
| 41 | 2 | $anotherAttribute = $this->parameter('field'); |
|
| 42 | 2 | $definedValues = $this->parameter('values'); |
|
| 43 | 2 | $anotherValue = $this->getAttribute()->getValue($anotherAttribute); |
|
| 44 | |||
| 45 | 2 | $this->setParameterTextValues((array) $anotherAttribute, 'other_attribute'); |
|
| 46 | 2 | $this->setParameterTextValues((array) $definedValues, 'other_value'); |
|
| 47 | |||
| 48 | if (in_array($anotherValue, $definedValues, is_bool($anotherValue) || null === $definedValues)) { |
||
| 49 | 2 | $presentValidator = $this->getRuleValidator('present'); |
|
| 50 | |||
| 51 | 2 | $presentValidator->setValidation($this->validation); |
|
|
|
|||
| 52 | 2 | $presentValidator->setAttribute($this->attribute); |
|
| 53 | |||
| 54 | 2 | return $presentValidator->check($value); |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | return true; |
|
| 58 | } |
||
| 60 |