| @@ 3138-3151 (lines=14) @@ | ||
| 3135 | * @return bool |
|
| 3136 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3137 | */ |
|
| 3138 | public function isAssoc(bool $recursive = false): bool |
|
| 3139 | { |
|
| 3140 | if ($this->isEmpty()) { |
|
| 3141 | return false; |
|
| 3142 | } |
|
| 3143 | ||
| 3144 | foreach ($this->keys($recursive)->getGeneratorByReference() as &$key) { |
|
| 3145 | if ((string) $key !== $key) { |
|
| 3146 | return false; |
|
| 3147 | } |
|
| 3148 | } |
|
| 3149 | ||
| 3150 | return true; |
|
| 3151 | } |
|
| 3152 | ||
| 3153 | /** |
|
| 3154 | * Check if a given key or keys are empty. |
|
| @@ 3215-3228 (lines=14) @@ | ||
| 3212 | * @return bool |
|
| 3213 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3214 | */ |
|
| 3215 | public function isNumeric(): bool |
|
| 3216 | { |
|
| 3217 | if ($this->isEmpty()) { |
|
| 3218 | return false; |
|
| 3219 | } |
|
| 3220 | ||
| 3221 | foreach ($this->keys()->getGeneratorByReference() as &$key) { |
|
| 3222 | if ((int) $key !== $key) { |
|
| 3223 | return false; |
|
| 3224 | } |
|
| 3225 | } |
|
| 3226 | ||
| 3227 | return true; |
|
| 3228 | } |
|
| 3229 | ||
| 3230 | /** |
|
| 3231 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|