| @@ 1648-1660 (lines=13) @@ | ||
| 1645 | * |
|
| 1646 | * @return static <p>(Immutable)</p> |
|
| 1647 | */ |
|
| 1648 | public function firstsImmutable(int $number = null) |
|
| 1649 | { |
|
| 1650 | if ($number === null) { |
|
| 1651 | $arrayTmp = $this->array; |
|
| 1652 | $array = (array)\array_shift($arrayTmp); |
|
| 1653 | } else { |
|
| 1654 | $number = (int)$number; |
|
| 1655 | $arrayTmp = $this->array; |
|
| 1656 | $array = \array_splice($arrayTmp, 0, $number, true); |
|
| 1657 | } |
|
| 1658 | ||
| 1659 | return static::create($array, $this->iteratorClass, false); |
|
| 1660 | } |
|
| 1661 | ||
| 1662 | /** |
|
| 1663 | * Get the first value(s) from the current array. |
|
| @@ 3753-3765 (lines=13) @@ | ||
| 3750 | * |
|
| 3751 | * @return static <p>(Immutable)</p> |
|
| 3752 | */ |
|
| 3753 | public function split(int $numberOfPieces = 2, bool $keepKeys = false) |
|
| 3754 | { |
|
| 3755 | $arrayCount = \count($this->array, COUNT_NORMAL); |
|
| 3756 | ||
| 3757 | if ($arrayCount === 0) { |
|
| 3758 | $result = []; |
|
| 3759 | } else { |
|
| 3760 | $splitSize = (int)\ceil($arrayCount / $numberOfPieces); |
|
| 3761 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
|
| 3762 | } |
|
| 3763 | ||
| 3764 | return static::create($result, $this->iteratorClass, false); |
|
| 3765 | } |
|
| 3766 | ||
| 3767 | /** |
|
| 3768 | * Stripe all empty items. |
|