Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | protected function evaluate($input, array $context = []): bool |
||
21 | { |
||
22 | if (is_countable($input)) { |
||
23 | return count($input) === $this->count; |
||
24 | } |
||
25 | |||
26 | if ($input instanceof Traversable) { |
||
27 | return iterator_count($input) === $this->count; |
||
28 | } |
||
29 | |||
30 | if (is_iterable($input)) { |
||
31 | $count = 0; |
||
32 | foreach ($input as $v) { |
||
33 | $count++; |
||
34 | } |
||
35 | |||
36 | return $count === $this->count; |
||
37 | } |
||
38 | |||
39 | return false; |
||
40 | } |
||
42 |