Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2327-2343 (lines=17) @@
2324
     * @psalm-return static<TKey,T>
2325
     * @psalm-mutation-free
2326
     */
2327
    public function firstsImmutable(int $number = null): self
2328
    {
2329
        $arrayTmp = $this->toArray();
2330
2331
        if ($number === null) {
2332
            $array = (array) \array_shift($arrayTmp);
2333
        } else {
2334
            $number = (int) $number;
2335
            $array = \array_splice($arrayTmp, 0, $number);
2336
        }
2337
2338
        return static::create(
2339
            $array,
2340
            $this->iteratorClass,
2341
            false
2342
        );
2343
    }
2344
2345
    /**
2346
     * Get the first value(s) from the current array.
@@ 2357-2373 (lines=17) @@
2354
     * @psalm-return static<TKey,T>
2355
     * @psalm-mutation-free
2356
     */
2357
    public function firstsKeys(int $number = null): self
2358
    {
2359
        $arrayTmp = $this->keys()->toArray();
2360
2361
        if ($number === null) {
2362
            $array = (array) \array_shift($arrayTmp);
2363
        } else {
2364
            $number = (int) $number;
2365
            $array = \array_splice($arrayTmp, 0, $number);
2366
        }
2367
2368
        return static::create(
2369
            $array,
2370
            $this->iteratorClass,
2371
            false
2372
        );
2373
    }
2374
2375
    /**
2376
     * Get and rmove the first value(s) from the current array.