| @@ 3179-3192 (lines=14) @@ | ||
| 3176 | * @return bool |
|
| 3177 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3178 | */ |
|
| 3179 | public function isAssoc(bool $recursive = false): bool |
|
| 3180 | { |
|
| 3181 | if ($this->isEmpty()) { |
|
| 3182 | return false; |
|
| 3183 | } |
|
| 3184 | ||
| 3185 | foreach ($this->keys($recursive)->getGeneratorByReference() as &$key) { |
|
| 3186 | if ((string) $key !== $key) { |
|
| 3187 | return false; |
|
| 3188 | } |
|
| 3189 | } |
|
| 3190 | ||
| 3191 | return true; |
|
| 3192 | } |
|
| 3193 | ||
| 3194 | /** |
|
| 3195 | * Check if a given key or keys are empty. |
|
| @@ 3256-3269 (lines=14) @@ | ||
| 3253 | * @return bool |
|
| 3254 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3255 | */ |
|
| 3256 | public function isNumeric(): bool |
|
| 3257 | { |
|
| 3258 | if ($this->isEmpty()) { |
|
| 3259 | return false; |
|
| 3260 | } |
|
| 3261 | ||
| 3262 | foreach ($this->keys()->getGeneratorByReference() as &$key) { |
|
| 3263 | if ((int) $key !== $key) { |
|
| 3264 | return false; |
|
| 3265 | } |
|
| 3266 | } |
|
| 3267 | ||
| 3268 | return true; |
|
| 3269 | } |
|
| 3270 | ||
| 3271 | /** |
|
| 3272 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|