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