| @@ 1287-1307 (lines=21) @@ | ||
| 1284 | yield $values; |
|
| 1285 | } |
|
| 1286 | }; |
|
| 1287 | } else { |
|
| 1288 | $generator = function () use ($size) { |
|
| 1289 | $values = []; |
|
| 1290 | $tmpCounter = 0; |
|
| 1291 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1292 | ++$tmpCounter; |
|
| 1293 | ||
| 1294 | $values[] = $value; |
|
| 1295 | if ($tmpCounter === $size) { |
|
| 1296 | yield $values; |
|
| 1297 | ||
| 1298 | $values = []; |
|
| 1299 | $tmpCounter = 0; |
|
| 1300 | } |
|
| 1301 | } |
|
| 1302 | ||
| 1303 | if ($values !== []) { |
|
| 1304 | yield $values; |
|
| 1305 | } |
|
| 1306 | }; |
|
| 1307 | } |
|
| 1308 | ||
| 1309 | return static::create( |
|
| 1310 | $generator, |
|
| @@ 6441-6464 (lines=24) @@ | ||
| 6438 | yield $carry; |
|
| 6439 | } |
|
| 6440 | }; |
|
| 6441 | } else { |
|
| 6442 | $generator = function () use ($numberOfPieces) { |
|
| 6443 | $carry = []; |
|
| 6444 | $i = 1; |
|
| 6445 | foreach ($this->getGenerator() as $key => $value) { |
|
| 6446 | $carry[] = $value; |
|
| 6447 | ||
| 6448 | if ($i % $numberOfPieces !== 0) { |
|
| 6449 | ++$i; |
|
| 6450 | ||
| 6451 | continue; |
|
| 6452 | } |
|
| 6453 | ||
| 6454 | yield $carry; |
|
| 6455 | ||
| 6456 | $carry = []; |
|
| 6457 | $i = 1; |
|
| 6458 | } |
|
| 6459 | ||
| 6460 | if ($carry !== []) { |
|
| 6461 | yield $carry; |
|
| 6462 | } |
|
| 6463 | }; |
|
| 6464 | } |
|
| 6465 | ||
| 6466 | return static::create( |
|
| 6467 | $generator, |
|