Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4548-4563 (lines=16) @@
4545
     * @psalm-return static<TKey,T>
4546
     * @psalm-mutation-free
4547
     */
4548
    public function moveElementToFirstPlace($key): self
4549
    {
4550
        $array = $this->toArray();
4551
4552
        if ($this->offsetExists($key)) {
4553
            $tmpValue = $this->get($key);
4554
            unset($array[$key]);
4555
            $array = [$key => $tmpValue] + $array;
4556
        }
4557
4558
        return static::create(
4559
            $array,
4560
            $this->iteratorClass,
4561
            false
4562
        );
4563
    }
4564
4565
    /**
4566
     * Move an array element to the last place.
@@ 4579-4594 (lines=16) @@
4576
     * @psalm-return static<TKey,T>
4577
     * @psalm-mutation-free
4578
     */
4579
    public function moveElementToLastPlace($key): self
4580
    {
4581
        $array = $this->toArray();
4582
4583
        if ($this->offsetExists($key)) {
4584
            $tmpValue = $this->get($key);
4585
            unset($array[$key]);
4586
            $array += [$key => $tmpValue];
4587
        }
4588
4589
        return static::create(
4590
            $array,
4591
            $this->iteratorClass,
4592
            false
4593
        );
4594
    }
4595
4596
    /**
4597
     * Moves the internal iterator position to the next element and returns this element.