| @@ 2334-2347 (lines=14) @@ | ||
| 2331 | * @return bool |
|
| 2332 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2333 | */ |
|
| 2334 | public function isAssoc(bool $recursive = false): bool |
|
| 2335 | { |
|
| 2336 | if ($this->isEmpty()) { |
|
| 2337 | return false; |
|
| 2338 | } |
|
| 2339 | ||
| 2340 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2341 | if ((string) $key !== $key) { |
|
| 2342 | return false; |
|
| 2343 | } |
|
| 2344 | } |
|
| 2345 | ||
| 2346 | return true; |
|
| 2347 | } |
|
| 2348 | ||
| 2349 | /** |
|
| 2350 | * Check if a given key or keys are empty. |
|
| @@ 2408-2421 (lines=14) @@ | ||
| 2405 | * @return bool |
|
| 2406 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2407 | */ |
|
| 2408 | public function isNumeric(): bool |
|
| 2409 | { |
|
| 2410 | if ($this->isEmpty()) { |
|
| 2411 | return false; |
|
| 2412 | } |
|
| 2413 | ||
| 2414 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 2415 | if ((int) $key !== $key) { |
|
| 2416 | return false; |
|
| 2417 | } |
|
| 2418 | } |
|
| 2419 | ||
| 2420 | return true; |
|
| 2421 | } |
|
| 2422 | ||
| 2423 | /** |
|
| 2424 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|