| @@ 2666-2679 (lines=14) @@ | ||
| 2663 | * @return bool |
|
| 2664 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2665 | */ |
|
| 2666 | public function isAssoc(bool $recursive = false): bool |
|
| 2667 | { |
|
| 2668 | if ($this->isEmpty()) { |
|
| 2669 | return false; |
|
| 2670 | } |
|
| 2671 | ||
| 2672 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2673 | if ((string) $key !== $key) { |
|
| 2674 | return false; |
|
| 2675 | } |
|
| 2676 | } |
|
| 2677 | ||
| 2678 | return true; |
|
| 2679 | } |
|
| 2680 | ||
| 2681 | /** |
|
| 2682 | * Check if a given key or keys are empty. |
|
| @@ 2742-2755 (lines=14) @@ | ||
| 2739 | * @return bool |
|
| 2740 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2741 | */ |
|
| 2742 | public function isNumeric(): bool |
|
| 2743 | { |
|
| 2744 | if ($this->isEmpty()) { |
|
| 2745 | return false; |
|
| 2746 | } |
|
| 2747 | ||
| 2748 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2749 | if ((int) $key !== $key) { |
|
| 2750 | return false; |
|
| 2751 | } |
|
| 2752 | } |
|
| 2753 | ||
| 2754 | return true; |
|
| 2755 | } |
|
| 2756 | ||
| 2757 | /** |
|
| 2758 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|