Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 5222-5233 (lines=12) @@
5219
     * @psalm-return static<TKey,T>
5220
     * @psalm-mutation-free
5221
     */
5222
    public function removeFirst(): self
5223
    {
5224
        $tmpArray = $this->toArray();
5225
5226
        \array_shift($tmpArray);
5227
5228
        return static::create(
5229
            $tmpArray,
5230
            $this->iteratorClass,
5231
            false
5232
        );
5233
    }
5234
5235
    /**
5236
     * Remove the last value from the current array.
@@ 5248-5259 (lines=12) @@
5245
     * @psalm-return static<TKey,T>
5246
     * @psalm-mutation-free
5247
     */
5248
    public function removeLast(): self
5249
    {
5250
        $tmpArray = $this->toArray();
5251
5252
        \array_pop($tmpArray);
5253
5254
        return static::create(
5255
            $tmpArray,
5256
            $this->iteratorClass,
5257
            false
5258
        );
5259
    }
5260
5261
    /**
5262
     * Removes a particular value from an array (numeric or associative).
@@ 5532-5541 (lines=10) @@
5529
     * @psalm-return static<TKey,T>
5530
     * @psalm-mutation-free
5531
     */
5532
    public function rest(int $from = 1): self
5533
    {
5534
        $tmpArray = $this->toArray();
5535
5536
        return static::create(
5537
            \array_splice($tmpArray, $from),
5538
            $this->iteratorClass,
5539
            false
5540
        );
5541
    }
5542
5543
    /**
5544
     * Return the array in the reverse order.