@@ 3096-3109 (lines=14) @@ | ||
3093 | * @return bool |
|
3094 | * <p>Returns true if associative, false otherwise.</p> |
|
3095 | */ |
|
3096 | public function isAssoc(bool $recursive = false): bool |
|
3097 | { |
|
3098 | if ($this->isEmpty()) { |
|
3099 | return false; |
|
3100 | } |
|
3101 | ||
3102 | foreach ($this->keys($recursive)->getGeneratorByReference() as &$key) { |
|
3103 | if ((string) $key !== $key) { |
|
3104 | return false; |
|
3105 | } |
|
3106 | } |
|
3107 | ||
3108 | return true; |
|
3109 | } |
|
3110 | ||
3111 | /** |
|
3112 | * Check if a given key or keys are empty. |
|
@@ 3173-3186 (lines=14) @@ | ||
3170 | * @return bool |
|
3171 | * <p>Returns true if numeric, false otherwise.</p> |
|
3172 | */ |
|
3173 | public function isNumeric(): bool |
|
3174 | { |
|
3175 | if ($this->isEmpty()) { |
|
3176 | return false; |
|
3177 | } |
|
3178 | ||
3179 | foreach ($this->keys()->getGeneratorByReference() as &$key) { |
|
3180 | if ((int) $key !== $key) { |
|
3181 | return false; |
|
3182 | } |
|
3183 | } |
|
3184 | ||
3185 | return true; |
|
3186 | } |
|
3187 | ||
3188 | /** |
|
3189 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |