| @@ 4225-4239 (lines=15) @@ | ||
| 4222 | * @psalm-return static<int|TKey,T> |
|
| 4223 | * @psalm-mutation-free |
|
| 4224 | */ |
|
| 4225 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4226 | { |
|
| 4227 | if ($recursive === true) { |
|
| 4228 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4229 | $result = \array_replace_recursive($this->toArray(), $array); |
|
| 4230 | } else { |
|
| 4231 | $result = \array_replace($this->toArray(), $array); |
|
| 4232 | } |
|
| 4233 | ||
| 4234 | return static::create( |
|
| 4235 | $result, |
|
| 4236 | $this->iteratorClass, |
|
| 4237 | false |
|
| 4238 | ); |
|
| 4239 | } |
|
| 4240 | ||
| 4241 | /** |
|
| 4242 | * Merge the new $array into the current array. |
|
| @@ 4267-4281 (lines=15) @@ | ||
| 4264 | * @psalm-return static<TKey,T> |
|
| 4265 | * @psalm-mutation-free |
|
| 4266 | */ |
|
| 4267 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
| 4268 | { |
|
| 4269 | if ($recursive === true) { |
|
| 4270 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4271 | $result = \array_merge_recursive($this->toArray(), $array); |
|
| 4272 | } else { |
|
| 4273 | $result = \array_merge($this->toArray(), $array); |
|
| 4274 | } |
|
| 4275 | ||
| 4276 | return static::create( |
|
| 4277 | $result, |
|
| 4278 | $this->iteratorClass, |
|
| 4279 | false |
|
| 4280 | ); |
|
| 4281 | } |
|
| 4282 | ||
| 4283 | /** |
|
| 4284 | * Merge the the current array into the $array. |
|
| @@ 4308-4322 (lines=15) @@ | ||
| 4305 | * @psalm-return static<TKey,T> |
|
| 4306 | * @psalm-mutation-free |
|
| 4307 | */ |
|
| 4308 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4309 | { |
|
| 4310 | if ($recursive === true) { |
|
| 4311 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4312 | $result = \array_replace_recursive($array, $this->toArray()); |
|
| 4313 | } else { |
|
| 4314 | $result = \array_replace($array, $this->toArray()); |
|
| 4315 | } |
|
| 4316 | ||
| 4317 | return static::create( |
|
| 4318 | $result, |
|
| 4319 | $this->iteratorClass, |
|
| 4320 | false |
|
| 4321 | ); |
|
| 4322 | } |
|
| 4323 | ||
| 4324 | /** |
|
| 4325 | * Merge the current array into the new $array. |
|
| @@ 4350-4364 (lines=15) @@ | ||
| 4347 | * @psalm-return static<TKey,T> |
|
| 4348 | * @psalm-mutation-free |
|
| 4349 | */ |
|
| 4350 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
| 4351 | { |
|
| 4352 | if ($recursive === true) { |
|
| 4353 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4354 | $result = \array_merge_recursive($array, $this->toArray()); |
|
| 4355 | } else { |
|
| 4356 | $result = \array_merge($array, $this->toArray()); |
|
| 4357 | } |
|
| 4358 | ||
| 4359 | return static::create( |
|
| 4360 | $result, |
|
| 4361 | $this->iteratorClass, |
|
| 4362 | false |
|
| 4363 | ); |
|
| 4364 | } |
|
| 4365 | ||
| 4366 | /** |
|
| 4367 | * @return ArrayyMeta|static |
|