Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4649-4664 (lines=16) @@
4646
     * @phpstan-return static<TKey,T>
4647
     * @psalm-mutation-free
4648
     */
4649
    public function moveElementToFirstPlace($key): self
4650
    {
4651
        $array = $this->toArray();
4652
4653
        if ($this->offsetExists($key)) {
4654
            $tmpValue = $this->get($key);
4655
            unset($array[$key]);
4656
            $array = [$key => $tmpValue] + $array;
4657
        }
4658
4659
        return static::create(
4660
            $array,
4661
            $this->iteratorClass,
4662
            false
4663
        );
4664
    }
4665
4666
    /**
4667
     * Move an array element to the last place.
@@ 4680-4695 (lines=16) @@
4677
     * @phpstan-return static<TKey,T>
4678
     * @psalm-mutation-free
4679
     */
4680
    public function moveElementToLastPlace($key): self
4681
    {
4682
        $array = $this->toArray();
4683
4684
        if ($this->offsetExists($key)) {
4685
            $tmpValue = $this->get($key);
4686
            unset($array[$key]);
4687
            $array += [$key => $tmpValue];
4688
        }
4689
4690
        return static::create(
4691
            $array,
4692
            $this->iteratorClass,
4693
            false
4694
        );
4695
    }
4696
4697
    /**
4698
     * Moves the internal iterator position to the next element and returns this element.