Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

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