Code Duplication    Length = 15-15 lines in 4 locations

src/Arrayy.php 4 locations

@@ 4116-4130 (lines=15) @@
4113
     * @psalm-return static<int|TKey,T>
4114
     * @psalm-mutation-free
4115
     */
4116
    public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self
4117
    {
4118
        if ($recursive === true) {
4119
            $array = $this->getArrayRecursiveHelperArrayy($array);
4120
            $result = \array_replace_recursive($this->toArray(), $array);
4121
        } else {
4122
            $result = \array_replace($this->toArray(), $array);
4123
        }
4124
4125
        return static::create(
4126
            $result,
4127
            $this->iteratorClass,
4128
            false
4129
        );
4130
    }
4131
4132
    /**
4133
     * Merge the new $array into the current array.
@@ 4154-4168 (lines=15) @@
4151
     * @psalm-return static<TKey,T>
4152
     * @psalm-mutation-free
4153
     */
4154
    public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self
4155
    {
4156
        if ($recursive === true) {
4157
            $array = $this->getArrayRecursiveHelperArrayy($array);
4158
            $result = \array_merge_recursive($this->toArray(), $array);
4159
        } else {
4160
            $result = \array_merge($this->toArray(), $array);
4161
        }
4162
4163
        return static::create(
4164
            $result,
4165
            $this->iteratorClass,
4166
            false
4167
        );
4168
    }
4169
4170
    /**
4171
     * Merge the the current array into the $array.
@@ 4191-4205 (lines=15) @@
4188
     * @psalm-return static<TKey,T>
4189
     * @psalm-mutation-free
4190
     */
4191
    public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self
4192
    {
4193
        if ($recursive === true) {
4194
            $array = $this->getArrayRecursiveHelperArrayy($array);
4195
            $result = \array_replace_recursive($array, $this->toArray());
4196
        } else {
4197
            $result = \array_replace($array, $this->toArray());
4198
        }
4199
4200
        return static::create(
4201
            $result,
4202
            $this->iteratorClass,
4203
            false
4204
        );
4205
    }
4206
4207
    /**
4208
     * Merge the current array into the new $array.
@@ 4229-4243 (lines=15) @@
4226
     * @psalm-return static<TKey,T>
4227
     * @psalm-mutation-free
4228
     */
4229
    public function mergePrependNewIndex(array $array = [], bool $recursive = false): self
4230
    {
4231
        if ($recursive === true) {
4232
            $array = $this->getArrayRecursiveHelperArrayy($array);
4233
            $result = \array_merge_recursive($array, $this->toArray());
4234
        } else {
4235
            $result = \array_merge($array, $this->toArray());
4236
        }
4237
4238
        return static::create(
4239
            $result,
4240
            $this->iteratorClass,
4241
            false
4242
        );
4243
    }
4244
4245
    /**
4246
     * @return ArrayyMeta|static