| @@ 2966-2979 (lines=14) @@ | ||
| 2963 | * @return bool |
|
| 2964 | * <p>Returns true if associative, false otherwise.</p> |
|
| 2965 | */ |
|
| 2966 | public function isAssoc(bool $recursive = false): bool |
|
| 2967 | { |
|
| 2968 | if ($this->isEmpty()) { |
|
| 2969 | return false; |
|
| 2970 | } |
|
| 2971 | ||
| 2972 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 2973 | if ((string) $key !== $key) { |
|
| 2974 | return false; |
|
| 2975 | } |
|
| 2976 | } |
|
| 2977 | ||
| 2978 | return true; |
|
| 2979 | } |
|
| 2980 | ||
| 2981 | /** |
|
| 2982 | * Check if a given key or keys are empty. |
|
| @@ 3043-3056 (lines=14) @@ | ||
| 3040 | * @return bool |
|
| 3041 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3042 | */ |
|
| 3043 | public function isNumeric(): bool |
|
| 3044 | { |
|
| 3045 | if ($this->isEmpty()) { |
|
| 3046 | return false; |
|
| 3047 | } |
|
| 3048 | ||
| 3049 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 3050 | if ((int) $key !== $key) { |
|
| 3051 | return false; |
|
| 3052 | } |
|
| 3053 | } |
|
| 3054 | ||
| 3055 | return true; |
|
| 3056 | } |
|
| 3057 | ||
| 3058 | /** |
|
| 3059 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|