@@ 1324-1344 (lines=21) @@ | ||
1321 | yield $values; |
|
1322 | } |
|
1323 | }; |
|
1324 | } else { |
|
1325 | $generator = function () use ($size) { |
|
1326 | $values = []; |
|
1327 | $tmpCounter = 0; |
|
1328 | foreach ($this->getGenerator() as $value) { |
|
1329 | ++$tmpCounter; |
|
1330 | ||
1331 | $values[] = $value; |
|
1332 | if ($tmpCounter === $size) { |
|
1333 | yield $values; |
|
1334 | ||
1335 | $values = []; |
|
1336 | $tmpCounter = 0; |
|
1337 | } |
|
1338 | } |
|
1339 | ||
1340 | if ($values !== []) { |
|
1341 | yield $values; |
|
1342 | } |
|
1343 | }; |
|
1344 | } |
|
1345 | ||
1346 | return static::create( |
|
1347 | $generator, |
|
@@ 6643-6666 (lines=24) @@ | ||
6640 | yield $carry; |
|
6641 | } |
|
6642 | }; |
|
6643 | } else { |
|
6644 | $generator = function () use ($numberOfPieces) { |
|
6645 | $carry = []; |
|
6646 | $i = 1; |
|
6647 | foreach ($this->getGenerator() as $value) { |
|
6648 | $carry[] = $value; |
|
6649 | ||
6650 | if ($i % $numberOfPieces !== 0) { |
|
6651 | ++$i; |
|
6652 | ||
6653 | continue; |
|
6654 | } |
|
6655 | ||
6656 | yield $carry; |
|
6657 | ||
6658 | $carry = []; |
|
6659 | $i = 1; |
|
6660 | } |
|
6661 | ||
6662 | if ($carry !== []) { |
|
6663 | yield $carry; |
|
6664 | } |
|
6665 | }; |
|
6666 | } |
|
6667 | ||
6668 | return static::create( |
|
6669 | $generator, |