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