| @@ 2364-2377 (lines=14) @@ | ||
| 2361 | * @return bool |
|
| 2362 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2363 | */ |
|
| 2364 | public function isAssoc(bool $recursive = false): bool |
|
| 2365 | { |
|
| 2366 | if ($this->isEmpty()) { |
|
| 2367 | return false; |
|
| 2368 | } |
|
| 2369 | ||
| 2370 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2371 | if ((string) $key !== $key) { |
|
| 2372 | return false; |
|
| 2373 | } |
|
| 2374 | } |
|
| 2375 | ||
| 2376 | return true; |
|
| 2377 | } |
|
| 2378 | ||
| 2379 | /** |
|
| 2380 | * Check if a given key or keys are empty. |
|
| @@ 2438-2451 (lines=14) @@ | ||
| 2435 | * @return bool |
|
| 2436 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2437 | */ |
|
| 2438 | public function isNumeric(): bool |
|
| 2439 | { |
|
| 2440 | if ($this->isEmpty()) { |
|
| 2441 | return false; |
|
| 2442 | } |
|
| 2443 | ||
| 2444 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2445 | if ((int) $key !== $key) { |
|
| 2446 | return false; |
|
| 2447 | } |
|
| 2448 | } |
|
| 2449 | ||
| 2450 | return true; |
|
| 2451 | } |
|
| 2452 | ||
| 2453 | /** |
|
| 2454 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|