| @@ 1292-1312 (lines=21) @@ | ||
| 1289 | yield $values; |
|
| 1290 | } |
|
| 1291 | }; |
|
| 1292 | } else { |
|
| 1293 | $generator = function () use ($size) { |
|
| 1294 | $values = []; |
|
| 1295 | $tmpCounter = 0; |
|
| 1296 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1297 | ++$tmpCounter; |
|
| 1298 | ||
| 1299 | $values[] = $value; |
|
| 1300 | if ($tmpCounter === $size) { |
|
| 1301 | yield $values; |
|
| 1302 | ||
| 1303 | $values = []; |
|
| 1304 | $tmpCounter = 0; |
|
| 1305 | } |
|
| 1306 | } |
|
| 1307 | ||
| 1308 | if ($values !== []) { |
|
| 1309 | yield $values; |
|
| 1310 | } |
|
| 1311 | }; |
|
| 1312 | } |
|
| 1313 | ||
| 1314 | return static::create( |
|
| 1315 | $generator, |
|
| @@ 6405-6428 (lines=24) @@ | ||
| 6402 | yield $carry; |
|
| 6403 | } |
|
| 6404 | }; |
|
| 6405 | } else { |
|
| 6406 | $generator = function () use ($numberOfPieces) { |
|
| 6407 | $carry = []; |
|
| 6408 | $i = 1; |
|
| 6409 | foreach ($this->getGenerator() as $key => $value) { |
|
| 6410 | $carry[] = $value; |
|
| 6411 | ||
| 6412 | if ($i % $numberOfPieces !== 0) { |
|
| 6413 | ++$i; |
|
| 6414 | ||
| 6415 | continue; |
|
| 6416 | } |
|
| 6417 | ||
| 6418 | yield $carry; |
|
| 6419 | ||
| 6420 | $carry = []; |
|
| 6421 | $i = 1; |
|
| 6422 | } |
|
| 6423 | ||
| 6424 | if ($carry !== []) { |
|
| 6425 | yield $carry; |
|
| 6426 | } |
|
| 6427 | }; |
|
| 6428 | } |
|
| 6429 | ||
| 6430 | return static::create( |
|
| 6431 | $generator, |
|