| @@ 2342-2355 (lines=14) @@ | ||
| 2339 | * @return bool |
|
| 2340 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2341 | */ |
|
| 2342 | public function isAssoc(bool $recursive = false): bool |
|
| 2343 | { |
|
| 2344 | if ($this->isEmpty()) { |
|
| 2345 | return false; |
|
| 2346 | } |
|
| 2347 | ||
| 2348 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2349 | if ((string) $key !== $key) { |
|
| 2350 | return false; |
|
| 2351 | } |
|
| 2352 | } |
|
| 2353 | ||
| 2354 | return true; |
|
| 2355 | } |
|
| 2356 | ||
| 2357 | /** |
|
| 2358 | * Check if a given key or keys are empty. |
|
| @@ 2416-2429 (lines=14) @@ | ||
| 2413 | * @return bool |
|
| 2414 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2415 | */ |
|
| 2416 | public function isNumeric(): bool |
|
| 2417 | { |
|
| 2418 | if ($this->isEmpty()) { |
|
| 2419 | return false; |
|
| 2420 | } |
|
| 2421 | ||
| 2422 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2423 | if ((int) $key !== $key) { |
|
| 2424 | return false; |
|
| 2425 | } |
|
| 2426 | } |
|
| 2427 | ||
| 2428 | return true; |
|
| 2429 | } |
|
| 2430 | ||
| 2431 | /** |
|
| 2432 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|