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