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