Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4377-4392 (lines=16) @@
4374
     * @psalm-return static<TKey,T>
4375
     * @psalm-mutation-free
4376
     */
4377
    public function moveElementToFirstPlace($key): self
4378
    {
4379
        $array = $this->toArray();
4380
4381
        if ($this->offsetExists($key)) {
4382
            $tmpValue = $this->get($key);
4383
            unset($array[$key]);
4384
            $array = [$key => $tmpValue] + $array;
4385
        }
4386
4387
        return static::create(
4388
            $array,
4389
            $this->iteratorClass,
4390
            false
4391
        );
4392
    }
4393
4394
    /**
4395
     * Move an array element to the last place.
@@ 4408-4423 (lines=16) @@
4405
     * @psalm-return static<TKey,T>
4406
     * @psalm-mutation-free
4407
     */
4408
    public function moveElementToLastPlace($key): self
4409
    {
4410
        $array = $this->toArray();
4411
4412
        if ($this->offsetExists($key)) {
4413
            $tmpValue = $this->get($key);
4414
            unset($array[$key]);
4415
            $array += [$key => $tmpValue];
4416
        }
4417
4418
        return static::create(
4419
            $array,
4420
            $this->iteratorClass,
4421
            false
4422
        );
4423
    }
4424
4425
    /**
4426
     * Moves the internal iterator position to the next element and returns this element.