| @@ 2920-2933 (lines=14) @@ | ||
| 2917 | * @return bool |
|
| 2918 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2919 | */ |
|
| 2920 | public function isAssoc(bool $recursive = false): bool |
|
| 2921 | { |
|
| 2922 | if ($this->isEmpty()) { |
|
| 2923 | return false; |
|
| 2924 | } |
|
| 2925 | ||
| 2926 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2927 | if ((string) $key !== $key) { |
|
| 2928 | return false; |
|
| 2929 | } |
|
| 2930 | } |
|
| 2931 | ||
| 2932 | return true; |
|
| 2933 | } |
|
| 2934 | ||
| 2935 | /** |
|
| 2936 | * Check if a given key or keys are empty. |
|
| @@ 2997-3010 (lines=14) @@ | ||
| 2994 | * @return bool |
|
| 2995 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 2996 | */ |
|
| 2997 | public function isNumeric(): bool |
|
| 2998 | { |
|
| 2999 | if ($this->isEmpty()) { |
|
| 3000 | return false; |
|
| 3001 | } |
|
| 3002 | ||
| 3003 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 3004 | if ((int) $key !== $key) { |
|
| 3005 | return false; |
|
| 3006 | } |
|
| 3007 | } |
|
| 3008 | ||
| 3009 | return true; |
|
| 3010 | } |
|
| 3011 | ||
| 3012 | /** |
|
| 3013 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|