| @@ 3733-3746 (lines=14) @@ | ||
| 3730 | * @return bool |
|
| 3731 | * <p>Returns true if associative, false otherwise.</p> |
|
| 3732 | */ |
|
| 3733 | public function isAssoc(bool $recursive = false): bool |
|
| 3734 | { |
|
| 3735 | if ($this->isEmpty()) { |
|
| 3736 | return false; |
|
| 3737 | } |
|
| 3738 | ||
| 3739 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
|
| 3740 | foreach ($this->keys($recursive)->getGeneratorByReference() as &$key) { |
|
| 3741 | if ((string) $key !== $key) { |
|
| 3742 | return false; |
|
| 3743 | } |
|
| 3744 | } |
|
| 3745 | ||
| 3746 | return true; |
|
| 3747 | } |
|
| 3748 | ||
| 3749 | /** |
|
| @@ 3821-3834 (lines=14) @@ | ||
| 3818 | * @return bool |
|
| 3819 | * <p>Returns true if numeric, false otherwise.</p> |
|
| 3820 | */ |
|
| 3821 | public function isNumeric(): bool |
|
| 3822 | { |
|
| 3823 | if ($this->isEmpty()) { |
|
| 3824 | return false; |
|
| 3825 | } |
|
| 3826 | ||
| 3827 | /** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection */ |
|
| 3828 | foreach ($this->keys()->getGeneratorByReference() as &$key) { |
|
| 3829 | if ((int) $key !== $key) { |
|
| 3830 | return false; |
|
| 3831 | } |
|
| 3832 | } |
|
| 3833 | ||
| 3834 | return true; |
|
| 3835 | } |
|
| 3836 | ||
| 3837 | /** |
|