| @@ 3132-3145 (lines=14) @@ | ||
| 3129 | * @return bool |
|
| 3130 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3131 | */ |
|
| 3132 | public function isAssoc(bool $recursive = false): bool |
|
| 3133 | { |
|
| 3134 | if ($this->isEmpty()) { |
|
| 3135 | return false; |
|
| 3136 | } |
|
| 3137 | ||
| 3138 | foreach ($this->keys($recursive)->getGeneratorByReference() as &$key) { |
|
| 3139 | if ((string) $key !== $key) { |
|
| 3140 | return false; |
|
| 3141 | } |
|
| 3142 | } |
|
| 3143 | ||
| 3144 | return true; |
|
| 3145 | } |
|
| 3146 | ||
| 3147 | /** |
|
| 3148 | * Check if a given key or keys are empty. |
|
| @@ 3209-3222 (lines=14) @@ | ||
| 3206 | * @return bool |
|
| 3207 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3208 | */ |
|
| 3209 | public function isNumeric(): bool |
|
| 3210 | { |
|
| 3211 | if ($this->isEmpty()) { |
|
| 3212 | return false; |
|
| 3213 | } |
|
| 3214 | ||
| 3215 | foreach ($this->keys()->getGeneratorByReference() as &$key) { |
|
| 3216 | if ((int) $key !== $key) { |
|
| 3217 | return false; |
|
| 3218 | } |
|
| 3219 | } |
|
| 3220 | ||
| 3221 | return true; |
|
| 3222 | } |
|
| 3223 | ||
| 3224 | /** |
|
| 3225 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|