Conditions | 6 |
Paths | 5 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
13 | function iterable_after(iterable $iterable, callable $matcher, bool $including = false): \Generator |
||
14 | { |
||
15 | $found = false; |
||
16 | |||
17 | foreach ($iterable as $key => $value) { |
||
18 | $matched = $found || (bool)call_user_func($matcher, $value, $key); |
||
19 | |||
20 | if ($found || ($matched && $including)) { |
||
21 | yield $key => $value; |
||
22 | } |
||
23 | |||
24 | $found = $matched; |
||
25 | } |
||
27 |