Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 3418-3433 (lines=16) @@
3415
     * @psalm-return static<TKey,T>
3416
     * @psalm-mutation-free
3417
     */
3418
    public function moveElementToFirstPlace($key): self
3419
    {
3420
        $array = $this->getArray();
3421
3422
        if ($this->offsetExists($key)) {
3423
            $tmpValue = $this->get($key);
3424
            unset($array[$key]);
3425
            $array = [$key => $tmpValue] + $array;
3426
        }
3427
3428
        return static::create(
3429
            $array,
3430
            $this->iteratorClass,
3431
            false
3432
        );
3433
    }
3434
3435
    /**
3436
     * Move an array element to the last place.
@@ 3449-3464 (lines=16) @@
3446
     * @psalm-return static<TKey,T>
3447
     * @psalm-mutation-free
3448
     */
3449
    public function moveElementToLastPlace($key): self
3450
    {
3451
        $array = $this->getArray();
3452
3453
        if ($this->offsetExists($key)) {
3454
            $tmpValue = $this->get($key);
3455
            unset($array[$key]);
3456
            $array += [$key => $tmpValue];
3457
        }
3458
3459
        return static::create(
3460
            $array,
3461
            $this->iteratorClass,
3462
            false
3463
        );
3464
    }
3465
3466
    /**
3467
     * Moves the internal iterator position to the next element and returns this element.