| @@ 1929-1945 (lines=17) @@ | ||
| 1926 | * |
|
| 1927 | * @psalm-return static<TKey,T> |
|
| 1928 | */ |
|
| 1929 | public function firstsImmutable(int $number = null): self |
|
| 1930 | { |
|
| 1931 | $arrayTmp = $this->getArray(); |
|
| 1932 | ||
| 1933 | if ($number === null) { |
|
| 1934 | $array = (array) \array_shift($arrayTmp); |
|
| 1935 | } else { |
|
| 1936 | $number = (int) $number; |
|
| 1937 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 1938 | } |
|
| 1939 | ||
| 1940 | return static::create( |
|
| 1941 | $array, |
|
| 1942 | $this->iteratorClass, |
|
| 1943 | false |
|
| 1944 | ); |
|
| 1945 | } |
|
| 1946 | ||
| 1947 | /** |
|
| 1948 | * Get the first value(s) from the current array. |
|
| @@ 1958-1974 (lines=17) @@ | ||
| 1955 | * |
|
| 1956 | * @psalm-return static<TKey,T> |
|
| 1957 | */ |
|
| 1958 | public function firstsKeys(int $number = null): self |
|
| 1959 | { |
|
| 1960 | $arrayTmp = $this->keys()->getArray(); |
|
| 1961 | ||
| 1962 | if ($number === null) { |
|
| 1963 | $array = (array) \array_shift($arrayTmp); |
|
| 1964 | } else { |
|
| 1965 | $number = (int) $number; |
|
| 1966 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 1967 | } |
|
| 1968 | ||
| 1969 | return static::create( |
|
| 1970 | $array, |
|
| 1971 | $this->iteratorClass, |
|
| 1972 | false |
|
| 1973 | ); |
|
| 1974 | } |
|
| 1975 | ||
| 1976 | /** |
|
| 1977 | * Get and rmove the first value(s) from the current array. |
|