Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3712-3727 (lines=16) @@
3709
     * @psalm-return static<TKey,T>
3710
     * @psalm-mutation-free
3711
     */
3712
    public function moveElementToFirstPlace($key): self
3713
    {
3714
        $array = $this->toArray();
3715
3716
        if ($this->offsetExists($key)) {
3717
            $tmpValue = $this->get($key);
3718
            unset($array[$key]);
3719
            $array = [$key => $tmpValue] + $array;
3720
        }
3721
3722
        return static::create(
3723
            $array,
3724
            $this->iteratorClass,
3725
            false
3726
        );
3727
    }
3728
3729
    /**
3730
     * Move an array element to the last place.
@@ 3743-3758 (lines=16) @@
3740
     * @psalm-return static<TKey,T>
3741
     * @psalm-mutation-free
3742
     */
3743
    public function moveElementToLastPlace($key): self
3744
    {
3745
        $array = $this->toArray();
3746
3747
        if ($this->offsetExists($key)) {
3748
            $tmpValue = $this->get($key);
3749
            unset($array[$key]);
3750
            $array += [$key => $tmpValue];
3751
        }
3752
3753
        return static::create(
3754
            $array,
3755
            $this->iteratorClass,
3756
            false
3757
        );
3758
    }
3759
3760
    /**
3761
     * Moves the internal iterator position to the next element and returns this element.