Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2234-2250 (lines=17) @@
2231
     * @psalm-return static<TKey,T>
2232
     * @psalm-mutation-free
2233
     */
2234
    public function firstsImmutable(int $number = null): self
2235
    {
2236
        $arrayTmp = $this->toArray();
2237
2238
        if ($number === null) {
2239
            $array = (array) \array_shift($arrayTmp);
2240
        } else {
2241
            $number = (int) $number;
2242
            $array = \array_splice($arrayTmp, 0, $number);
2243
        }
2244
2245
        return static::create(
2246
            $array,
2247
            $this->iteratorClass,
2248
            false
2249
        );
2250
    }
2251
2252
    /**
2253
     * Get the first value(s) from the current array.
@@ 2264-2280 (lines=17) @@
2261
     * @psalm-return static<TKey,T>
2262
     * @psalm-mutation-free
2263
     */
2264
    public function firstsKeys(int $number = null): self
2265
    {
2266
        $arrayTmp = $this->keys()->toArray();
2267
2268
        if ($number === null) {
2269
            $array = (array) \array_shift($arrayTmp);
2270
        } else {
2271
            $number = (int) $number;
2272
            $array = \array_splice($arrayTmp, 0, $number);
2273
        }
2274
2275
        return static::create(
2276
            $array,
2277
            $this->iteratorClass,
2278
            false
2279
        );
2280
    }
2281
2282
    /**
2283
     * Get and rmove the first value(s) from the current array.