Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4680-4695 (lines=16) @@
4677
     * @phpstan-return static<TKey,T>
4678
     * @psalm-mutation-free
4679
     */
4680
    public function moveElementToFirstPlace($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] + $array;
4688
        }
4689
4690
        return static::create(
4691
            $array,
4692
            $this->iteratorClass,
4693
            false
4694
        );
4695
    }
4696
4697
    /**
4698
     * Move an array element to the last place.
@@ 4711-4726 (lines=16) @@
4708
     * @phpstan-return static<TKey,T>
4709
     * @psalm-mutation-free
4710
     */
4711
    public function moveElementToLastPlace($key): self
4712
    {
4713
        $array = $this->toArray();
4714
4715
        if ($this->offsetExists($key)) {
4716
            $tmpValue = $this->get($key);
4717
            unset($array[$key]);
4718
            $array += [$key => $tmpValue];
4719
        }
4720
4721
        return static::create(
4722
            $array,
4723
            $this->iteratorClass,
4724
            false
4725
        );
4726
    }
4727
4728
    /**
4729
     * Moves the internal iterator position to the next element and returns this element.