Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4153-4168 (lines=16) @@
4150
     * @psalm-return static<TKey,T>
4151
     * @psalm-mutation-free
4152
     */
4153
    public function moveElementToFirstPlace($key): self
4154
    {
4155
        $array = $this->toArray();
4156
4157
        if ($this->offsetExists($key)) {
4158
            $tmpValue = $this->get($key);
4159
            unset($array[$key]);
4160
            $array = [$key => $tmpValue] + $array;
4161
        }
4162
4163
        return static::create(
4164
            $array,
4165
            $this->iteratorClass,
4166
            false
4167
        );
4168
    }
4169
4170
    /**
4171
     * Move an array element to the last place.
@@ 4184-4199 (lines=16) @@
4181
     * @psalm-return static<TKey,T>
4182
     * @psalm-mutation-free
4183
     */
4184
    public function moveElementToLastPlace($key): self
4185
    {
4186
        $array = $this->toArray();
4187
4188
        if ($this->offsetExists($key)) {
4189
            $tmpValue = $this->get($key);
4190
            unset($array[$key]);
4191
            $array += [$key => $tmpValue];
4192
        }
4193
4194
        return static::create(
4195
            $array,
4196
            $this->iteratorClass,
4197
            false
4198
        );
4199
    }
4200
4201
    /**
4202
     * Moves the internal iterator position to the next element and returns this element.