| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.072 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function check($value): bool |
||
| 32 | { |
||
| 33 | 2 | $this->requireParameters(['allowed_values']); |
|
| 34 | |||
| 35 | 2 | $this->setAllowedValues($allowedValues = $this->parameter('allowed_values')); |
|
| 36 | |||
| 37 | if (is_array($value)) { |
||
| 38 | 2 | return Arr::first($value) === $allowedValues; |
|
| 39 | } |
||
| 40 | |||
| 41 | if (is_string($value)) { |
||
| 42 | 2 | return Text::startsWith($value, $allowedValues); |
|
| 43 | } |
||
| 44 | |||
| 45 | return false; |
||
| 46 | } |
||
| 48 |