Code Duplication    Length = 16-16 lines in 2 locations

src/Arrayy.php 2 locations

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