@@ 1957-1973 (lines=17) @@ | ||
1954 | * @psalm-return static<TKey,T> |
|
1955 | * @psalm-mutation-free |
|
1956 | */ |
|
1957 | public function firstsImmutable(int $number = null): self |
|
1958 | { |
|
1959 | $arrayTmp = $this->getArray(); |
|
1960 | ||
1961 | if ($number === null) { |
|
1962 | $array = (array) \array_shift($arrayTmp); |
|
1963 | } else { |
|
1964 | $number = (int) $number; |
|
1965 | $array = \array_splice($arrayTmp, 0, $number); |
|
1966 | } |
|
1967 | ||
1968 | return static::create( |
|
1969 | $array, |
|
1970 | $this->iteratorClass, |
|
1971 | false |
|
1972 | ); |
|
1973 | } |
|
1974 | ||
1975 | /** |
|
1976 | * Get the first value(s) from the current array. |
|
@@ 1987-2003 (lines=17) @@ | ||
1984 | * @psalm-return static<TKey,T> |
|
1985 | * @psalm-mutation-free |
|
1986 | */ |
|
1987 | public function firstsKeys(int $number = null): self |
|
1988 | { |
|
1989 | $arrayTmp = $this->keys()->getArray(); |
|
1990 | ||
1991 | if ($number === null) { |
|
1992 | $array = (array) \array_shift($arrayTmp); |
|
1993 | } else { |
|
1994 | $number = (int) $number; |
|
1995 | $array = \array_splice($arrayTmp, 0, $number); |
|
1996 | } |
|
1997 | ||
1998 | return static::create( |
|
1999 | $array, |
|
2000 | $this->iteratorClass, |
|
2001 | false |
|
2002 | ); |
|
2003 | } |
|
2004 | ||
2005 | /** |
|
2006 | * Get and rmove the first value(s) from the current array. |