Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3976-3991 (lines=16) @@
3973
     * @psalm-return static<TKey,T>
3974
     * @psalm-mutation-free
3975
     */
3976
    public function moveElementToFirstPlace($key): self
3977
    {
3978
        $array = $this->toArray();
3979
3980
        if ($this->offsetExists($key)) {
3981
            $tmpValue = $this->get($key);
3982
            unset($array[$key]);
3983
            $array = [$key => $tmpValue] + $array;
3984
        }
3985
3986
        return static::create(
3987
            $array,
3988
            $this->iteratorClass,
3989
            false
3990
        );
3991
    }
3992
3993
    /**
3994
     * Move an array element to the last place.
@@ 4007-4022 (lines=16) @@
4004
     * @psalm-return static<TKey,T>
4005
     * @psalm-mutation-free
4006
     */
4007
    public function moveElementToLastPlace($key): self
4008
    {
4009
        $array = $this->toArray();
4010
4011
        if ($this->offsetExists($key)) {
4012
            $tmpValue = $this->get($key);
4013
            unset($array[$key]);
4014
            $array += [$key => $tmpValue];
4015
        }
4016
4017
        return static::create(
4018
            $array,
4019
            $this->iteratorClass,
4020
            false
4021
        );
4022
    }
4023
4024
    /**
4025
     * Moves the internal iterator position to the next element and returns this element.