| @@ 2376-2389 (lines=14) @@ | ||
| 2373 | * @return bool |
|
| 2374 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2375 | */ |
|
| 2376 | public function isAssoc(bool $recursive = false): bool |
|
| 2377 | { |
|
| 2378 | if ($this->isEmpty()) { |
|
| 2379 | return false; |
|
| 2380 | } |
|
| 2381 | ||
| 2382 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2383 | if ((string) $key !== $key) { |
|
| 2384 | return false; |
|
| 2385 | } |
|
| 2386 | } |
|
| 2387 | ||
| 2388 | return true; |
|
| 2389 | } |
|
| 2390 | ||
| 2391 | /** |
|
| 2392 | * Check if a given key or keys are empty. |
|
| @@ 2450-2463 (lines=14) @@ | ||
| 2447 | * @return bool |
|
| 2448 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2449 | */ |
|
| 2450 | public function isNumeric(): bool |
|
| 2451 | { |
|
| 2452 | if ($this->isEmpty()) { |
|
| 2453 | return false; |
|
| 2454 | } |
|
| 2455 | ||
| 2456 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2457 | if ((int) $key !== $key) { |
|
| 2458 | return false; |
|
| 2459 | } |
|
| 2460 | } |
|
| 2461 | ||
| 2462 | return true; |
|
| 2463 | } |
|
| 2464 | ||
| 2465 | /** |
|
| 2466 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|