| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | function exactly(int $n, iterable $items, callable $callback, int $mode = CALLBACK_USE_VALUE): bool |
||
| 30 | { |
||
| 31 | $count = 0; |
||
| 32 | foreach ($items as $key => $value) { |
||
| 33 | if (true === call_user_func_array($callback, __args($mode, $key, $value))) { |
||
| 34 | $count++; |
||
| 35 | if ($count > $n) { |
||
| 36 | return false; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | return $count === $n; |
||
| 42 | } |
||
| 43 |