Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3893-3908 (lines=16) @@
3890
     * @psalm-return static<TKey,T>
3891
     * @psalm-mutation-free
3892
     */
3893
    public function moveElementToFirstPlace($key): self
3894
    {
3895
        $array = $this->toArray();
3896
3897
        if ($this->offsetExists($key)) {
3898
            $tmpValue = $this->get($key);
3899
            unset($array[$key]);
3900
            $array = [$key => $tmpValue] + $array;
3901
        }
3902
3903
        return static::create(
3904
            $array,
3905
            $this->iteratorClass,
3906
            false
3907
        );
3908
    }
3909
3910
    /**
3911
     * Move an array element to the last place.
@@ 3924-3939 (lines=16) @@
3921
     * @psalm-return static<TKey,T>
3922
     * @psalm-mutation-free
3923
     */
3924
    public function moveElementToLastPlace($key): self
3925
    {
3926
        $array = $this->toArray();
3927
3928
        if ($this->offsetExists($key)) {
3929
            $tmpValue = $this->get($key);
3930
            unset($array[$key]);
3931
            $array += [$key => $tmpValue];
3932
        }
3933
3934
        return static::create(
3935
            $array,
3936
            $this->iteratorClass,
3937
            false
3938
        );
3939
    }
3940
3941
    /**
3942
     * Moves the internal iterator position to the next element and returns this element.