| @@ 1303-1323 (lines=21) @@ | ||
| 1300 | yield $values; |
|
| 1301 | } |
|
| 1302 | }; |
|
| 1303 | } else { |
|
| 1304 | $generator = function () use ($size) { |
|
| 1305 | $values = []; |
|
| 1306 | $tmpCounter = 0; |
|
| 1307 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1308 | ++$tmpCounter; |
|
| 1309 | ||
| 1310 | $values[] = $value; |
|
| 1311 | if ($tmpCounter === $size) { |
|
| 1312 | yield $values; |
|
| 1313 | ||
| 1314 | $values = []; |
|
| 1315 | $tmpCounter = 0; |
|
| 1316 | } |
|
| 1317 | } |
|
| 1318 | ||
| 1319 | if ($values !== []) { |
|
| 1320 | yield $values; |
|
| 1321 | } |
|
| 1322 | }; |
|
| 1323 | } |
|
| 1324 | ||
| 1325 | return static::create( |
|
| 1326 | $generator, |
|
| @@ 6576-6599 (lines=24) @@ | ||
| 6573 | yield $carry; |
|
| 6574 | } |
|
| 6575 | }; |
|
| 6576 | } else { |
|
| 6577 | $generator = function () use ($numberOfPieces) { |
|
| 6578 | $carry = []; |
|
| 6579 | $i = 1; |
|
| 6580 | foreach ($this->getGenerator() as $key => $value) { |
|
| 6581 | $carry[] = $value; |
|
| 6582 | ||
| 6583 | if ($i % $numberOfPieces !== 0) { |
|
| 6584 | ++$i; |
|
| 6585 | ||
| 6586 | continue; |
|
| 6587 | } |
|
| 6588 | ||
| 6589 | yield $carry; |
|
| 6590 | ||
| 6591 | $carry = []; |
|
| 6592 | $i = 1; |
|
| 6593 | } |
|
| 6594 | ||
| 6595 | if ($carry !== []) { |
|
| 6596 | yield $carry; |
|
| 6597 | } |
|
| 6598 | }; |
|
| 6599 | } |
|
| 6600 | ||
| 6601 | return static::create( |
|
| 6602 | $generator, |
|