Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2314-2330 (lines=17) @@
2311
     * @psalm-return static<TKey,T>
2312
     * @psalm-mutation-free
2313
     */
2314
    public function firstsImmutable(int $number = null): self
2315
    {
2316
        $arrayTmp = $this->toArray();
2317
2318
        if ($number === null) {
2319
            $array = (array) \array_shift($arrayTmp);
2320
        } else {
2321
            $number = (int) $number;
2322
            $array = \array_splice($arrayTmp, 0, $number);
2323
        }
2324
2325
        return static::create(
2326
            $array,
2327
            $this->iteratorClass,
2328
            false
2329
        );
2330
    }
2331
2332
    /**
2333
     * Get the first value(s) from the current array.
@@ 2344-2360 (lines=17) @@
2341
     * @psalm-return static<TKey,T>
2342
     * @psalm-mutation-free
2343
     */
2344
    public function firstsKeys(int $number = null): self
2345
    {
2346
        $arrayTmp = $this->keys()->toArray();
2347
2348
        if ($number === null) {
2349
            $array = (array) \array_shift($arrayTmp);
2350
        } else {
2351
            $number = (int) $number;
2352
            $array = \array_splice($arrayTmp, 0, $number);
2353
        }
2354
2355
        return static::create(
2356
            $array,
2357
            $this->iteratorClass,
2358
            false
2359
        );
2360
    }
2361
2362
    /**
2363
     * Get and rmove the first value(s) from the current array.