Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
58 | 232 | public static function type($value, $choices, $keyword, $pointer = null) |
|
59 | { |
||
60 | 232 | $actualType = gettype($value); |
|
61 | 232 | $choices = is_array($choices) ? $choices : [$choices]; |
|
62 | |||
63 | 232 | if (in_array($actualType, $choices) || |
|
64 | 232 | (is_json_number($value) && in_array('number', $choices))) { |
|
65 | 176 | return; |
|
66 | } |
||
67 | |||
68 | 56 | throw InvalidSchemaException::invalidParameterType( |
|
69 | 56 | $actualType, |
|
70 | 56 | $choices, |
|
71 | 56 | $keyword, |
|
72 | $pointer |
||
73 | 56 | ); |
|
74 | } |
||
75 | } |
||
76 |