Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4094-4109 (lines=16) @@
4091
     * @psalm-return static<TKey,T>
4092
     * @psalm-mutation-free
4093
     */
4094
    public function moveElementToFirstPlace($key): self
4095
    {
4096
        $array = $this->toArray();
4097
4098
        if ($this->offsetExists($key)) {
4099
            $tmpValue = $this->get($key);
4100
            unset($array[$key]);
4101
            $array = [$key => $tmpValue] + $array;
4102
        }
4103
4104
        return static::create(
4105
            $array,
4106
            $this->iteratorClass,
4107
            false
4108
        );
4109
    }
4110
4111
    /**
4112
     * Move an array element to the last place.
@@ 4125-4140 (lines=16) @@
4122
     * @psalm-return static<TKey,T>
4123
     * @psalm-mutation-free
4124
     */
4125
    public function moveElementToLastPlace($key): self
4126
    {
4127
        $array = $this->toArray();
4128
4129
        if ($this->offsetExists($key)) {
4130
            $tmpValue = $this->get($key);
4131
            unset($array[$key]);
4132
            $array += [$key => $tmpValue];
4133
        }
4134
4135
        return static::create(
4136
            $array,
4137
            $this->iteratorClass,
4138
            false
4139
        );
4140
    }
4141
4142
    /**
4143
     * Moves the internal iterator position to the next element and returns this element.