| @@ 2659-2674 (lines=16) @@ | ||
| 2656 | * @psalm-return static<TKey,T> |
|
| 2657 | * @psalm-mutation-free |
|
| 2658 | */ |
|
| 2659 | public function firstsKeys(int $number = null): self |
|
| 2660 | { |
|
| 2661 | $arrayTmp = $this->keys()->toArray(); |
|
| 2662 | ||
| 2663 | if ($number === null) { |
|
| 2664 | $array = (array) \array_shift($arrayTmp); |
|
| 2665 | } else { |
|
| 2666 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 2667 | } |
|
| 2668 | ||
| 2669 | return static::create( |
|
| 2670 | $array, |
|
| 2671 | $this->iteratorClass, |
|
| 2672 | false |
|
| 2673 | ); |
|
| 2674 | } |
|
| 2675 | ||
| 2676 | /** |
|
| 2677 | * Get and remove the first value(s) from the current array. |
|
| @@ 4239-4253 (lines=15) @@ | ||
| 4236 | * @psalm-return static<int|TKey,T> |
|
| 4237 | * @psalm-mutation-free |
|
| 4238 | */ |
|
| 4239 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4240 | { |
|
| 4241 | if ($recursive === true) { |
|
| 4242 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4243 | $result = \array_replace_recursive($this->toArray(), $array); |
|
| 4244 | } else { |
|
| 4245 | $result = \array_replace($this->toArray(), $array); |
|
| 4246 | } |
|
| 4247 | ||
| 4248 | return static::create( |
|
| 4249 | $result, |
|
| 4250 | $this->iteratorClass, |
|
| 4251 | false |
|
| 4252 | ); |
|
| 4253 | } |
|
| 4254 | ||
| 4255 | /** |
|
| 4256 | * Merge the new $array into the current array. |
|
| @@ 4281-4295 (lines=15) @@ | ||
| 4278 | * @psalm-return static<TKey,T> |
|
| 4279 | * @psalm-mutation-free |
|
| 4280 | */ |
|
| 4281 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
| 4282 | { |
|
| 4283 | if ($recursive === true) { |
|
| 4284 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4285 | $result = \array_merge_recursive($this->toArray(), $array); |
|
| 4286 | } else { |
|
| 4287 | $result = \array_merge($this->toArray(), $array); |
|
| 4288 | } |
|
| 4289 | ||
| 4290 | return static::create( |
|
| 4291 | $result, |
|
| 4292 | $this->iteratorClass, |
|
| 4293 | false |
|
| 4294 | ); |
|
| 4295 | } |
|
| 4296 | ||
| 4297 | /** |
|
| 4298 | * Merge the the current array into the $array. |
|
| @@ 4322-4336 (lines=15) @@ | ||
| 4319 | * @psalm-return static<TKey,T> |
|
| 4320 | * @psalm-mutation-free |
|
| 4321 | */ |
|
| 4322 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4323 | { |
|
| 4324 | if ($recursive === true) { |
|
| 4325 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4326 | $result = \array_replace_recursive($array, $this->toArray()); |
|
| 4327 | } else { |
|
| 4328 | $result = \array_replace($array, $this->toArray()); |
|
| 4329 | } |
|
| 4330 | ||
| 4331 | return static::create( |
|
| 4332 | $result, |
|
| 4333 | $this->iteratorClass, |
|
| 4334 | false |
|
| 4335 | ); |
|
| 4336 | } |
|
| 4337 | ||
| 4338 | /** |
|
| 4339 | * Merge the current array into the new $array. |
|
| @@ 4364-4378 (lines=15) @@ | ||
| 4361 | * @psalm-return static<TKey,T> |
|
| 4362 | * @psalm-mutation-free |
|
| 4363 | */ |
|
| 4364 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
| 4365 | { |
|
| 4366 | if ($recursive === true) { |
|
| 4367 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4368 | $result = \array_merge_recursive($array, $this->toArray()); |
|
| 4369 | } else { |
|
| 4370 | $result = \array_merge($array, $this->toArray()); |
|
| 4371 | } |
|
| 4372 | ||
| 4373 | return static::create( |
|
| 4374 | $result, |
|
| 4375 | $this->iteratorClass, |
|
| 4376 | false |
|
| 4377 | ); |
|
| 4378 | } |
|
| 4379 | ||
| 4380 | /** |
|
| 4381 | * @return ArrayyMeta|mixed|static |
|