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