Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3935-3950 (lines=16) @@
3932
     * @psalm-return static<TKey,T>
3933
     * @psalm-mutation-free
3934
     */
3935
    public function moveElementToFirstPlace($key): self
3936
    {
3937
        $array = $this->toArray();
3938
3939
        if ($this->offsetExists($key)) {
3940
            $tmpValue = $this->get($key);
3941
            unset($array[$key]);
3942
            $array = [$key => $tmpValue] + $array;
3943
        }
3944
3945
        return static::create(
3946
            $array,
3947
            $this->iteratorClass,
3948
            false
3949
        );
3950
    }
3951
3952
    /**
3953
     * Move an array element to the last place.
@@ 3966-3981 (lines=16) @@
3963
     * @psalm-return static<TKey,T>
3964
     * @psalm-mutation-free
3965
     */
3966
    public function moveElementToLastPlace($key): self
3967
    {
3968
        $array = $this->toArray();
3969
3970
        if ($this->offsetExists($key)) {
3971
            $tmpValue = $this->get($key);
3972
            unset($array[$key]);
3973
            $array += [$key => $tmpValue];
3974
        }
3975
3976
        return static::create(
3977
            $array,
3978
            $this->iteratorClass,
3979
            false
3980
        );
3981
    }
3982
3983
    /**
3984
     * Moves the internal iterator position to the next element and returns this element.