@@ 1850-1866 (lines=17) @@ | ||
1847 | * @return static |
|
1848 | * <p>(Immutable)</p> |
|
1849 | */ |
|
1850 | public function firstsImmutable(int $number = null): self |
|
1851 | { |
|
1852 | $arrayTmp = $this->getArray(); |
|
1853 | ||
1854 | if ($number === null) { |
|
1855 | $array = (array) \array_shift($arrayTmp); |
|
1856 | } else { |
|
1857 | $number = (int) $number; |
|
1858 | $array = \array_splice($arrayTmp, 0, $number); |
|
1859 | } |
|
1860 | ||
1861 | return static::create( |
|
1862 | $array, |
|
1863 | $this->iteratorClass, |
|
1864 | false |
|
1865 | ); |
|
1866 | } |
|
1867 | ||
1868 | /** |
|
1869 | * Get the first value(s) from the current array. |
|
@@ 1877-1893 (lines=17) @@ | ||
1874 | * @return static |
|
1875 | * <p>(Immutable)</p> |
|
1876 | */ |
|
1877 | public function firstsKeys(int $number = null): self |
|
1878 | { |
|
1879 | $arrayTmp = $this->keys()->getArray(); |
|
1880 | ||
1881 | if ($number === null) { |
|
1882 | $array = (array) \array_shift($arrayTmp); |
|
1883 | } else { |
|
1884 | $number = (int) $number; |
|
1885 | $array = \array_splice($arrayTmp, 0, $number); |
|
1886 | } |
|
1887 | ||
1888 | return static::create( |
|
1889 | $array, |
|
1890 | $this->iteratorClass, |
|
1891 | false |
|
1892 | ); |
|
1893 | } |
|
1894 | ||
1895 | /** |
|
1896 | * Get and rmove the first value(s) from the current array. |