@@ 2625-2638 (lines=14) @@ | ||
2622 | * @return bool |
|
2623 | * <p>Returns true if associative, false otherwise.</p> |
|
2624 | */ |
|
2625 | public function isAssoc(bool $recursive = false): bool |
|
2626 | { |
|
2627 | if ($this->isEmpty()) { |
|
2628 | return false; |
|
2629 | } |
|
2630 | ||
2631 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
2632 | if ((string) $key !== $key) { |
|
2633 | return false; |
|
2634 | } |
|
2635 | } |
|
2636 | ||
2637 | return true; |
|
2638 | } |
|
2639 | ||
2640 | /** |
|
2641 | * Check if a given key or keys are empty. |
|
@@ 2701-2714 (lines=14) @@ | ||
2698 | * @return bool |
|
2699 | * <p>Returns true if numeric, false otherwise.</p> |
|
2700 | */ |
|
2701 | public function isNumeric(): bool |
|
2702 | { |
|
2703 | if ($this->isEmpty()) { |
|
2704 | return false; |
|
2705 | } |
|
2706 | ||
2707 | foreach ($this->keys()->getGenerator() as $key) { |
|
2708 | if ((int) $key !== $key) { |
|
2709 | return false; |
|
2710 | } |
|
2711 | } |
|
2712 | ||
2713 | return true; |
|
2714 | } |
|
2715 | ||
2716 | /** |
|
2717 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |