Conditions | 3 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
16 | 2 | public function getIterator() |
|
17 | { |
||
18 | 2 | $innerCount = $this->innerIterator->count(); |
|
19 | 2 | $count = min($this->count, $innerCount); |
|
20 | 2 | $indexes = []; |
|
21 | 2 | for ($i = 0; $i < $count; $i++) { |
|
22 | do { |
||
23 | 2 | $index = rand(0, $innerCount - 1); |
|
24 | 2 | } while (isset($indexes[$index])); |
|
25 | 2 | $indexes[$index] = $index; |
|
26 | } |
||
27 | 2 | return new IndexIterator($this->innerIterator, $indexes); |
|
28 | 2 | } |
|
29 | 2 | ||
35 |