| @@ 2968-2981 (lines=14) @@ | ||
| 2965 | * @return bool |
|
| 2966 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2967 | */ |
|
| 2968 | public function isAssoc(bool $recursive = false): bool |
|
| 2969 | { |
|
| 2970 | if ($this->isEmpty()) { |
|
| 2971 | return false; |
|
| 2972 | } |
|
| 2973 | ||
| 2974 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2975 | if ((string) $key !== $key) { |
|
| 2976 | return false; |
|
| 2977 | } |
|
| 2978 | } |
|
| 2979 | ||
| 2980 | return true; |
|
| 2981 | } |
|
| 2982 | ||
| 2983 | /** |
|
| 2984 | * Check if a given key or keys are empty. |
|
| @@ 3045-3058 (lines=14) @@ | ||
| 3042 | * @return bool |
|
| 3043 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3044 | */ |
|
| 3045 | public function isNumeric(): bool |
|
| 3046 | { |
|
| 3047 | if ($this->isEmpty()) { |
|
| 3048 | return false; |
|
| 3049 | } |
|
| 3050 | ||
| 3051 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 3052 | if ((int) $key !== $key) { |
|
| 3053 | return false; |
|
| 3054 | } |
|
| 3055 | } |
|
| 3056 | ||
| 3057 | return true; |
|
| 3058 | } |
|
| 3059 | ||
| 3060 | /** |
|
| 3061 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|