Code Duplication    Length = 15-15 lines in 4 locations

src/Arrayy.php 4 locations

@@ 4120-4134 (lines=15) @@
4117
     * @psalm-return static<int|TKey,T>
4118
     * @psalm-mutation-free
4119
     */
4120
    public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self
4121
    {
4122
        if ($recursive === true) {
4123
            $array = $this->getArrayRecursiveHelperArrayy($array);
4124
            $result = \array_replace_recursive($this->toArray(), $array);
4125
        } else {
4126
            $result = \array_replace($this->toArray(), $array);
4127
        }
4128
4129
        return static::create(
4130
            $result,
4131
            $this->iteratorClass,
4132
            false
4133
        );
4134
    }
4135
4136
    /**
4137
     * Merge the new $array into the current array.
@@ 4162-4176 (lines=15) @@
4159
     * @psalm-return static<TKey,T>
4160
     * @psalm-mutation-free
4161
     */
4162
    public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self
4163
    {
4164
        if ($recursive === true) {
4165
            $array = $this->getArrayRecursiveHelperArrayy($array);
4166
            $result = \array_merge_recursive($this->toArray(), $array);
4167
        } else {
4168
            $result = \array_merge($this->toArray(), $array);
4169
        }
4170
4171
        return static::create(
4172
            $result,
4173
            $this->iteratorClass,
4174
            false
4175
        );
4176
    }
4177
4178
    /**
4179
     * Merge the the current array into the $array.
@@ 4203-4217 (lines=15) @@
4200
     * @psalm-return static<TKey,T>
4201
     * @psalm-mutation-free
4202
     */
4203
    public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self
4204
    {
4205
        if ($recursive === true) {
4206
            $array = $this->getArrayRecursiveHelperArrayy($array);
4207
            $result = \array_replace_recursive($array, $this->toArray());
4208
        } else {
4209
            $result = \array_replace($array, $this->toArray());
4210
        }
4211
4212
        return static::create(
4213
            $result,
4214
            $this->iteratorClass,
4215
            false
4216
        );
4217
    }
4218
4219
    /**
4220
     * Merge the current array into the new $array.
@@ 4245-4259 (lines=15) @@
4242
     * @psalm-return static<TKey,T>
4243
     * @psalm-mutation-free
4244
     */
4245
    public function mergePrependNewIndex(array $array = [], bool $recursive = false): self
4246
    {
4247
        if ($recursive === true) {
4248
            $array = $this->getArrayRecursiveHelperArrayy($array);
4249
            $result = \array_merge_recursive($array, $this->toArray());
4250
        } else {
4251
            $result = \array_merge($array, $this->toArray());
4252
        }
4253
4254
        return static::create(
4255
            $result,
4256
            $this->iteratorClass,
4257
            false
4258
        );
4259
    }
4260
4261
    /**
4262
     * @return ArrayyMeta|static