@@ 2517-2530 (lines=14) @@ | ||
2514 | * @return bool |
|
2515 | * <p>Returns true if associative, false otherwise.</p> |
|
2516 | */ |
|
2517 | public function isAssoc(bool $recursive = false): bool |
|
2518 | { |
|
2519 | if ($this->isEmpty()) { |
|
2520 | return false; |
|
2521 | } |
|
2522 | ||
2523 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
2524 | if ((string) $key !== $key) { |
|
2525 | return false; |
|
2526 | } |
|
2527 | } |
|
2528 | ||
2529 | return true; |
|
2530 | } |
|
2531 | ||
2532 | /** |
|
2533 | * Check if a given key or keys are empty. |
|
@@ 2593-2606 (lines=14) @@ | ||
2590 | * @return bool |
|
2591 | * <p>Returns true if numeric, false otherwise.</p> |
|
2592 | */ |
|
2593 | public function isNumeric(): bool |
|
2594 | { |
|
2595 | if ($this->isEmpty()) { |
|
2596 | return false; |
|
2597 | } |
|
2598 | ||
2599 | foreach ($this->keys()->getGenerator() as $key) { |
|
2600 | if ((int) $key !== $key) { |
|
2601 | return false; |
|
2602 | } |
|
2603 | } |
|
2604 | ||
2605 | return true; |
|
2606 | } |
|
2607 | ||
2608 | /** |
|
2609 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |