Conditions | 6 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function isValid($input, array $context = []): bool |
||
21 | { |
||
22 | if (is_array($input)) { |
||
23 | return array_key_exists($this->key, $input); |
||
24 | } |
||
25 | |||
26 | if ($input instanceof ArrayAccess) { |
||
27 | return $input->offsetExists($this->key); |
||
28 | } |
||
29 | |||
30 | if (is_iterable($input)) { |
||
31 | foreach ($input as $k => $v) { |
||
32 | if ($this->key === $k) { |
||
33 | return true; |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | |||
38 | return false; |
||
39 | } |
||
41 |