Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3764-3779 (lines=16) @@
3761
     * @psalm-return static<TKey,T>
3762
     * @psalm-mutation-free
3763
     */
3764
    public function moveElementToFirstPlace($key): self
3765
    {
3766
        $array = $this->toArray();
3767
3768
        if ($this->offsetExists($key)) {
3769
            $tmpValue = $this->get($key);
3770
            unset($array[$key]);
3771
            $array = [$key => $tmpValue] + $array;
3772
        }
3773
3774
        return static::create(
3775
            $array,
3776
            $this->iteratorClass,
3777
            false
3778
        );
3779
    }
3780
3781
    /**
3782
     * Move an array element to the last place.
@@ 3795-3810 (lines=16) @@
3792
     * @psalm-return static<TKey,T>
3793
     * @psalm-mutation-free
3794
     */
3795
    public function moveElementToLastPlace($key): self
3796
    {
3797
        $array = $this->toArray();
3798
3799
        if ($this->offsetExists($key)) {
3800
            $tmpValue = $this->get($key);
3801
            unset($array[$key]);
3802
            $array += [$key => $tmpValue];
3803
        }
3804
3805
        return static::create(
3806
            $array,
3807
            $this->iteratorClass,
3808
            false
3809
        );
3810
    }
3811
3812
    /**
3813
     * Moves the internal iterator position to the next element and returns this element.