| @@ 1734-1746 (lines=13) @@ | ||
| 1731 | * @return static |
|
| 1732 | * <p>(Immutable)</p> |
|
| 1733 | */ |
|
| 1734 | public function firstsImmutable(int $number = null) |
|
| 1735 | { |
|
| 1736 | if ($number === null) { |
|
| 1737 | $arrayTmp = $this->array; |
|
| 1738 | $array = (array) \array_shift($arrayTmp); |
|
| 1739 | } else { |
|
| 1740 | $number = (int) $number; |
|
| 1741 | $arrayTmp = $this->array; |
|
| 1742 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 1743 | } |
|
| 1744 | ||
| 1745 | return static::create($array, $this->iteratorClass, false); |
|
| 1746 | } |
|
| 1747 | ||
| 1748 | /** |
|
| 1749 | * Get the first value(s) from the current array. |
|
| @@ 3923-3935 (lines=13) @@ | ||
| 3920 | * @return static |
|
| 3921 | * <p>(Immutable)</p> |
|
| 3922 | */ |
|
| 3923 | public function split(int $numberOfPieces = 2, bool $keepKeys = false) |
|
| 3924 | { |
|
| 3925 | $arrayCount = \count($this->array, \COUNT_NORMAL); |
|
| 3926 | ||
| 3927 | if ($arrayCount === 0) { |
|
| 3928 | $result = []; |
|
| 3929 | } else { |
|
| 3930 | $splitSize = (int) \ceil($arrayCount / $numberOfPieces); |
|
| 3931 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
|
| 3932 | } |
|
| 3933 | ||
| 3934 | return static::create($result, $this->iteratorClass, false); |
|
| 3935 | } |
|
| 3936 | ||
| 3937 | /** |
|
| 3938 | * Stripe all empty items. |
|