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