Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 1713-1728 (lines=16) @@
1710
     * @return static
1711
     *                <p>(Immutable)</p>
1712
     */
1713
    public function moveElementToFirstPlace($key): self
1714
    {
1715
        $array = $this->getArray();
1716
1717
        if ($this->offsetExists($key)) {
1718
            $tmpValue = $this->get($key);
1719
            unset($array[$key]);
1720
            $array = [$key => $tmpValue] + $array;
1721
        }
1722
1723
        return static::create(
1724
            $array,
1725
            $this->iteratorClass,
1726
            false
1727
        );
1728
    }
1729
1730
    /**
1731
     * Move an array element to the last place.
@@ 1741-1756 (lines=16) @@
1738
     * @return static
1739
     *                <p>(Immutable)</p>
1740
     */
1741
    public function moveElementToLastPlace($key): self
1742
    {
1743
        $array = $this->getArray();
1744
1745
        if ($this->offsetExists($key)) {
1746
            $tmpValue = $this->get($key);
1747
            unset($array[$key]);
1748
            $array += [$key => $tmpValue];
1749
        }
1750
1751
        return static::create(
1752
            $array,
1753
            $this->iteratorClass,
1754
            false
1755
        );
1756
    }
1757
1758
    /**
1759
     * Get the first key from the current array.