Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4502-4517 (lines=16) @@
4499
     * @psalm-return static<TKey,T>
4500
     * @psalm-mutation-free
4501
     */
4502
    public function moveElementToFirstPlace($key): self
4503
    {
4504
        $array = $this->toArray();
4505
4506
        if ($this->offsetExists($key)) {
4507
            $tmpValue = $this->get($key);
4508
            unset($array[$key]);
4509
            $array = [$key => $tmpValue] + $array;
4510
        }
4511
4512
        return static::create(
4513
            $array,
4514
            $this->iteratorClass,
4515
            false
4516
        );
4517
    }
4518
4519
    /**
4520
     * Move an array element to the last place.
@@ 4533-4548 (lines=16) @@
4530
     * @psalm-return static<TKey,T>
4531
     * @psalm-mutation-free
4532
     */
4533
    public function moveElementToLastPlace($key): self
4534
    {
4535
        $array = $this->toArray();
4536
4537
        if ($this->offsetExists($key)) {
4538
            $tmpValue = $this->get($key);
4539
            unset($array[$key]);
4540
            $array += [$key => $tmpValue];
4541
        }
4542
4543
        return static::create(
4544
            $array,
4545
            $this->iteratorClass,
4546
            false
4547
        );
4548
    }
4549
4550
    /**
4551
     * Moves the internal iterator position to the next element and returns this element.