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