| @@ 3053-3066 (lines=14) @@ | ||
| 3050 | * @return bool |
|
| 3051 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3052 | */ |
|
| 3053 | public function isAssoc(bool $recursive = false): bool |
|
| 3054 | { |
|
| 3055 | if ($this->isEmpty()) { |
|
| 3056 | return false; |
|
| 3057 | } |
|
| 3058 | ||
| 3059 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 3060 | if ((string) $key !== $key) { |
|
| 3061 | return false; |
|
| 3062 | } |
|
| 3063 | } |
|
| 3064 | ||
| 3065 | return true; |
|
| 3066 | } |
|
| 3067 | ||
| 3068 | /** |
|
| 3069 | * Check if a given key or keys are empty. |
|
| @@ 3130-3143 (lines=14) @@ | ||
| 3127 | * @return bool |
|
| 3128 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3129 | */ |
|
| 3130 | public function isNumeric(): bool |
|
| 3131 | { |
|
| 3132 | if ($this->isEmpty()) { |
|
| 3133 | return false; |
|
| 3134 | } |
|
| 3135 | ||
| 3136 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 3137 | if ((int) $key !== $key) { |
|
| 3138 | return false; |
|
| 3139 | } |
|
| 3140 | } |
|
| 3141 | ||
| 3142 | return true; |
|
| 3143 | } |
|
| 3144 | ||
| 3145 | /** |
|
| 3146 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|