| @@ 3063-3076 (lines=14) @@ | ||
| 3060 | * @return bool |
|
| 3061 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3062 | */ |
|
| 3063 | public function isAssoc(bool $recursive = false): bool |
|
| 3064 | { |
|
| 3065 | if ($this->isEmpty()) { |
|
| 3066 | return false; |
|
| 3067 | } |
|
| 3068 | ||
| 3069 | foreach ($this->keys($recursive)->getGenerator() as $key) { |
|
| 3070 | if ((string) $key !== $key) { |
|
| 3071 | return false; |
|
| 3072 | } |
|
| 3073 | } |
|
| 3074 | ||
| 3075 | return true; |
|
| 3076 | } |
|
| 3077 | ||
| 3078 | /** |
|
| 3079 | * Check if a given key or keys are empty. |
|
| @@ 3140-3153 (lines=14) @@ | ||
| 3137 | * @return bool |
|
| 3138 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3139 | */ |
|
| 3140 | public function isNumeric(): bool |
|
| 3141 | { |
|
| 3142 | if ($this->isEmpty()) { |
|
| 3143 | return false; |
|
| 3144 | } |
|
| 3145 | ||
| 3146 | foreach ($this->keys()->getGenerator() as $key) { |
|
| 3147 | if ((int) $key !== $key) { |
|
| 3148 | return false; |
|
| 3149 | } |
|
| 3150 | } |
|
| 3151 | ||
| 3152 | return true; |
|
| 3153 | } |
|
| 3154 | ||
| 3155 | /** |
|
| 3156 | * Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. |
|