|
6 | 6 | use Utopia\Telemetry\Adapter\None as NoTelemetry; |
7 | 7 | use Utopia\Telemetry\Histogram; |
8 | 8 | use Utopia\Telemetry\UpDownCounter; |
| 9 | +use Utopia\Validator\ArrayList; |
| 10 | +use Utopia\Validator\Boolean; |
| 11 | +use Utopia\Validator\FloatValidator; |
| 12 | +use Utopia\Validator\Integer; |
| 13 | +use Utopia\Validator\Text; |
9 | 14 |
|
10 | 15 | class App |
11 | 16 | { |
@@ -718,7 +723,7 @@ protected function getArguments(Hook $hook, array $values, array $requestParams) |
718 | 723 | } |
719 | 724 | if (\is_array($value)) { |
720 | 725 | $validator = $param['validator']; |
721 | | - $isArrayList = $validator instanceof \Utopia\Validator\ArrayList; |
| 726 | + $isArrayList = $validator instanceof ArrayList; |
722 | 727 |
|
723 | 728 | if ($isArrayList) { |
724 | 729 | try { |
@@ -750,20 +755,20 @@ protected function getArguments(Hook $hook, array $values, array $requestParams) |
750 | 755 | $validator = $this->validate($key, $param, $value); |
751 | 756 |
|
752 | 757 | if ($existsInRequest && $value !== null) { |
753 | | - if ($validator instanceof \Utopia\Validator\Boolean) { |
| 758 | + if ($validator instanceof Boolean) { |
754 | 759 | $value = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); |
755 | 760 | if ($value === null) { |
756 | 761 | throw new Exception('Invalid boolean value for param "' . $key . '"', 400); |
757 | 762 | } |
758 | | - } elseif ($validator instanceof \Utopia\Validator\Integer && \is_string($value)) { |
| 763 | + } elseif ($validator instanceof Integer && \is_string($value)) { |
759 | 764 | if (\is_numeric($value)) { |
760 | 765 | $value = (int)$value; |
761 | 766 | } |
762 | | - } elseif ($validator instanceof \Utopia\Validator\FloatValidator && \is_string($value)) { |
| 767 | + } elseif ($validator instanceof FloatValidator && \is_string($value)) { |
763 | 768 | if (\is_numeric($value)) { |
764 | 769 | $value = (float)$value; |
765 | 770 | } |
766 | | - } elseif ($validator instanceof \Utopia\Validator\Text && !\is_string($value)) { |
| 771 | + } elseif ($validator instanceof Text && !\is_string($value)) { |
767 | 772 | $value = (string)$value; |
768 | 773 | } |
769 | 774 | } |
|
0 commit comments