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