@@ 2460-2473 (lines=14) @@ | ||
2457 | * @return bool |
|
2458 | * <p>Returns true if associative, false otherwise.</p> |
|
2459 | */ |
|
2460 | public function isAssoc(bool $recursive = false): bool |
|
2461 | { |
|
2462 | if ($this->isEmpty()) { |
|
2463 | return false; |
|
2464 | } |
|
2465 | ||
2466 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
2467 | if ((string) $key !== $key) { |
|
2468 | return false; |
|
2469 | } |
|
2470 | } |
|
2471 | ||
2472 | return true; |
|
2473 | } |
|
2474 | ||
2475 | /** |
|
2476 | * Check if a given key or keys are empty. |
|
@@ 2534-2547 (lines=14) @@ | ||
2531 | * @return bool |
|
2532 | * <p>Returns true if numeric, false otherwise.</p> |
|
2533 | */ |
|
2534 | public function isNumeric(): bool |
|
2535 | { |
|
2536 | if ($this->isEmpty()) { |
|
2537 | return false; |
|
2538 | } |
|
2539 | ||
2540 | foreach ($this->keys()->getGenerator() as $key) { |
|
2541 | if ((int) $key !== $key) { |
|
2542 | return false; |
|
2543 | } |
|
2544 | } |
|
2545 | ||
2546 | return true; |
|
2547 | } |
|
2548 | ||
2549 | /** |
|
2550 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |