| @@ 1672-1684 (lines=13) @@ | ||
| 1669 | * |
|
| 1670 | * @return static <p>(Immutable)</p> |
|
| 1671 | */ |
|
| 1672 | public function firstsImmutable(int $number = null) |
|
| 1673 | { |
|
| 1674 | if ($number === null) { |
|
| 1675 | $arrayTmp = $this->array; |
|
| 1676 | $array = (array)\array_shift($arrayTmp); |
|
| 1677 | } else { |
|
| 1678 | $number = (int)$number; |
|
| 1679 | $arrayTmp = $this->array; |
|
| 1680 | $array = \array_splice($arrayTmp, 0, $number, true); |
|
| 1681 | } |
|
| 1682 | ||
| 1683 | return static::create($array, $this->iteratorClass, false); |
|
| 1684 | } |
|
| 1685 | ||
| 1686 | /** |
|
| 1687 | * Get the first value(s) from the current array. |
|
| @@ 3777-3789 (lines=13) @@ | ||
| 3774 | * |
|
| 3775 | * @return static <p>(Immutable)</p> |
|
| 3776 | */ |
|
| 3777 | public function split(int $numberOfPieces = 2, bool $keepKeys = false) |
|
| 3778 | { |
|
| 3779 | $arrayCount = \count($this->array, COUNT_NORMAL); |
|
| 3780 | ||
| 3781 | if ($arrayCount === 0) { |
|
| 3782 | $result = []; |
|
| 3783 | } else { |
|
| 3784 | $splitSize = (int)\ceil($arrayCount / $numberOfPieces); |
|
| 3785 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
|
| 3786 | } |
|
| 3787 | ||
| 3788 | return static::create($result, $this->iteratorClass, false); |
|
| 3789 | } |
|
| 3790 | ||
| 3791 | /** |
|
| 3792 | * Stripe all empty items. |
|