Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
31 | 1 | public function apply(\Iterator $set) |
|
32 | { |
||
33 | 1 | $group = 0; |
|
34 | 1 | $counter = $this->chunkSize; |
|
35 | 1 | $ret = []; |
|
36 | |||
37 | 1 | foreach ($set as $item) { |
|
38 | |||
39 | 1 | $ret[$group][] = $item; |
|
40 | |||
41 | 1 | if (--$counter === 0) { |
|
42 | 1 | $counter = $this->chunkSize; |
|
43 | 1 | ++$group; |
|
44 | } |
||
45 | } |
||
46 | |||
47 | 1 | return new \ArrayIterator($ret); |
|
48 | } |
||
50 |