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