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