Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 5337-5348 (lines=12) @@
5334
     * @psalm-return static<TKey,T>
5335
     * @psalm-mutation-free
5336
     */
5337
    public function removeFirst(): self
5338
    {
5339
        $tmpArray = $this->toArray();
5340
5341
        \array_shift($tmpArray);
5342
5343
        return static::create(
5344
            $tmpArray,
5345
            $this->iteratorClass,
5346
            false
5347
        );
5348
    }
5349
5350
    /**
5351
     * Remove the last value from the current array.
@@ 5363-5374 (lines=12) @@
5360
     * @psalm-return static<TKey,T>
5361
     * @psalm-mutation-free
5362
     */
5363
    public function removeLast(): self
5364
    {
5365
        $tmpArray = $this->toArray();
5366
5367
        \array_pop($tmpArray);
5368
5369
        return static::create(
5370
            $tmpArray,
5371
            $this->iteratorClass,
5372
            false
5373
        );
5374
    }
5375
5376
    /**
5377
     * Removes a particular value from an array (numeric or associative).
@@ 5647-5656 (lines=10) @@
5644
     * @psalm-return static<TKey,T>
5645
     * @psalm-mutation-free
5646
     */
5647
    public function rest(int $from = 1): self
5648
    {
5649
        $tmpArray = $this->toArray();
5650
5651
        return static::create(
5652
            \array_splice($tmpArray, $from),
5653
            $this->iteratorClass,
5654
            false
5655
        );
5656
    }
5657
5658
    /**
5659
     * Return the array in the reverse order.