| @@ 2765-2780 (lines=16) @@ | ||
| 2762 | * @phpstan-return static<TKey,T> |
|
| 2763 | * @psalm-mutation-free |
|
| 2764 | */ |
|
| 2765 | public function firstsKeys(int $number = null): self |
|
| 2766 | { |
|
| 2767 | $arrayTmp = $this->keys()->toArray(); |
|
| 2768 | ||
| 2769 | if ($number === null) { |
|
| 2770 | $array = (array) \array_shift($arrayTmp); |
|
| 2771 | } else { |
|
| 2772 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 2773 | } |
|
| 2774 | ||
| 2775 | return static::create( |
|
| 2776 | $array, |
|
| 2777 | $this->iteratorClass, |
|
| 2778 | false |
|
| 2779 | ); |
|
| 2780 | } |
|
| 2781 | ||
| 2782 | /** |
|
| 2783 | * Get and remove the first value(s) from the current array. |
|
| @@ 4373-4387 (lines=15) @@ | ||
| 4370 | * @phpstan-return static<int|TKey,T> |
|
| 4371 | * @psalm-mutation-free |
|
| 4372 | */ |
|
| 4373 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4374 | { |
|
| 4375 | if ($recursive === true) { |
|
| 4376 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4377 | $result = \array_replace_recursive($this->toArray(), $array); |
|
| 4378 | } else { |
|
| 4379 | $result = \array_replace($this->toArray(), $array); |
|
| 4380 | } |
|
| 4381 | ||
| 4382 | return static::create( |
|
| 4383 | $result, |
|
| 4384 | $this->iteratorClass, |
|
| 4385 | false |
|
| 4386 | ); |
|
| 4387 | } |
|
| 4388 | ||
| 4389 | /** |
|
| 4390 | * Merge the new $array into the current array. |
|
| @@ 4415-4429 (lines=15) @@ | ||
| 4412 | * @phpstan-return static<int,T> |
|
| 4413 | * @psalm-mutation-free |
|
| 4414 | */ |
|
| 4415 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
| 4416 | { |
|
| 4417 | if ($recursive === true) { |
|
| 4418 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4419 | $result = \array_merge_recursive($this->toArray(), $array); |
|
| 4420 | } else { |
|
| 4421 | $result = \array_merge($this->toArray(), $array); |
|
| 4422 | } |
|
| 4423 | ||
| 4424 | return static::create( |
|
| 4425 | $result, |
|
| 4426 | $this->iteratorClass, |
|
| 4427 | false |
|
| 4428 | ); |
|
| 4429 | } |
|
| 4430 | ||
| 4431 | /** |
|
| 4432 | * Merge the the current array into the $array. |
|
| @@ 4456-4470 (lines=15) @@ | ||
| 4453 | * @phpstan-return static<TKey,T> |
|
| 4454 | * @psalm-mutation-free |
|
| 4455 | */ |
|
| 4456 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4457 | { |
|
| 4458 | if ($recursive === true) { |
|
| 4459 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4460 | $result = \array_replace_recursive($array, $this->toArray()); |
|
| 4461 | } else { |
|
| 4462 | $result = \array_replace($array, $this->toArray()); |
|
| 4463 | } |
|
| 4464 | ||
| 4465 | return static::create( |
|
| 4466 | $result, |
|
| 4467 | $this->iteratorClass, |
|
| 4468 | false |
|
| 4469 | ); |
|
| 4470 | } |
|
| 4471 | ||
| 4472 | /** |
|
| 4473 | * Merge the current array into the new $array. |
|
| @@ 4498-4512 (lines=15) @@ | ||
| 4495 | * @phpstan-return static<int,T> |
|
| 4496 | * @psalm-mutation-free |
|
| 4497 | */ |
|
| 4498 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
| 4499 | { |
|
| 4500 | if ($recursive === true) { |
|
| 4501 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4502 | $result = \array_merge_recursive($array, $this->toArray()); |
|
| 4503 | } else { |
|
| 4504 | $result = \array_merge($array, $this->toArray()); |
|
| 4505 | } |
|
| 4506 | ||
| 4507 | return static::create( |
|
| 4508 | $result, |
|
| 4509 | $this->iteratorClass, |
|
| 4510 | false |
|
| 4511 | ); |
|
| 4512 | } |
|
| 4513 | ||
| 4514 | /** |
|
| 4515 | * @return ArrayyMeta|mixed|static |
|