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