| @@ 2471-2484 (lines=14) @@ | ||
| 2468 | * @return bool |
|
| 2469 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2470 | */ |
|
| 2471 | public function isAssoc(bool $recursive = false): bool |
|
| 2472 | { |
|
| 2473 | if ($this->isEmpty()) { |
|
| 2474 | return false; |
|
| 2475 | } |
|
| 2476 | ||
| 2477 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2478 | if ((string) $key !== $key) { |
|
| 2479 | return false; |
|
| 2480 | } |
|
| 2481 | } |
|
| 2482 | ||
| 2483 | return true; |
|
| 2484 | } |
|
| 2485 | ||
| 2486 | /** |
|
| 2487 | * Check if a given key or keys are empty. |
|
| @@ 2545-2558 (lines=14) @@ | ||
| 2542 | * @return bool |
|
| 2543 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2544 | */ |
|
| 2545 | public function isNumeric(): bool |
|
| 2546 | { |
|
| 2547 | if ($this->isEmpty()) { |
|
| 2548 | return false; |
|
| 2549 | } |
|
| 2550 | ||
| 2551 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2552 | if ((int) $key !== $key) { |
|
| 2553 | return false; |
|
| 2554 | } |
|
| 2555 | } |
|
| 2556 | ||
| 2557 | return true; |
|
| 2558 | } |
|
| 2559 | ||
| 2560 | /** |
|
| 2561 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|