Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 4099-4114 (lines=16) @@
4096
     * @psalm-return static<TKey,T>
4097
     * @psalm-mutation-free
4098
     */
4099
    public function moveElementToFirstPlace($key): self
4100
    {
4101
        $array = $this->toArray();
4102
4103
        if ($this->offsetExists($key)) {
4104
            $tmpValue = $this->get($key);
4105
            unset($array[$key]);
4106
            $array = [$key => $tmpValue] + $array;
4107
        }
4108
4109
        return static::create(
4110
            $array,
4111
            $this->iteratorClass,
4112
            false
4113
        );
4114
    }
4115
4116
    /**
4117
     * Move an array element to the last place.
@@ 4130-4145 (lines=16) @@
4127
     * @psalm-return static<TKey,T>
4128
     * @psalm-mutation-free
4129
     */
4130
    public function moveElementToLastPlace($key): self
4131
    {
4132
        $array = $this->toArray();
4133
4134
        if ($this->offsetExists($key)) {
4135
            $tmpValue = $this->get($key);
4136
            unset($array[$key]);
4137
            $array += [$key => $tmpValue];
4138
        }
4139
4140
        return static::create(
4141
            $array,
4142
            $this->iteratorClass,
4143
            false
4144
        );
4145
    }
4146
4147
    /**
4148
     * Moves the internal iterator position to the next element and returns this element.