Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 5436-5447 (lines=12) @@
5433
     * @psalm-return static<TKey,T>
5434
     * @psalm-mutation-free
5435
     */
5436
    public function removeFirst(): self
5437
    {
5438
        $tmpArray = $this->toArray();
5439
5440
        \array_shift($tmpArray);
5441
5442
        return static::create(
5443
            $tmpArray,
5444
            $this->iteratorClass,
5445
            false
5446
        );
5447
    }
5448
5449
    /**
5450
     * Remove the last value from the current array.
@@ 5462-5473 (lines=12) @@
5459
     * @psalm-return static<TKey,T>
5460
     * @psalm-mutation-free
5461
     */
5462
    public function removeLast(): self
5463
    {
5464
        $tmpArray = $this->toArray();
5465
5466
        \array_pop($tmpArray);
5467
5468
        return static::create(
5469
            $tmpArray,
5470
            $this->iteratorClass,
5471
            false
5472
        );
5473
    }
5474
5475
    /**
5476
     * Removes a particular value from an array (numeric or associative).
@@ 5763-5772 (lines=10) @@
5760
     * @psalm-return static<TKey,T>
5761
     * @psalm-mutation-free
5762
     */
5763
    public function rest(int $from = 1): self
5764
    {
5765
        $tmpArray = $this->toArray();
5766
5767
        return static::create(
5768
            \array_splice($tmpArray, $from),
5769
            $this->iteratorClass,
5770
            false
5771
        );
5772
    }
5773
5774
    /**
5775
     * Return the array in the reverse order.