Conditions | 4 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 1 | public function getIterator(): Generator |
|
44 | { |
||
45 | 1 | $retries = $this->retries; |
|
46 | 1 | $seen = []; |
|
47 | |||
48 | 1 | foreach ($this->iterable as $generator => [$key, $value]) { |
|
49 | 1 | if (0 === $retries) { |
|
50 | 1 | $generator->send(InterruptableIterableIteratorAggregate::BREAK); |
|
51 | } |
||
52 | |||
53 | 1 | if (in_array($value, $seen, true)) { |
|
54 | 1 | --$retries; |
|
55 | |||
56 | 1 | continue; |
|
57 | } |
||
58 | |||
59 | 1 | $seen[] = $value; |
|
60 | |||
61 | 1 | yield $key => $value; |
|
62 | } |
||
65 |