Conditions | 6 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function validate($value, $parameter, Validator $validator) |
||
18 | { |
||
19 | Assert::type($parameter, 'array', self::KEYWORD, $validator->getSchemaPath()); |
||
20 | |||
21 | if (is_object($value)) { |
||
22 | foreach ($parameter as $i) { |
||
23 | if (is_object($i) && $value == $i) { |
||
24 | return null; |
||
25 | } |
||
26 | } |
||
27 | } else { |
||
28 | if (in_array($value, $parameter, true)) { |
||
29 | return null; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return error('The value must be one of: {parameter}', $validator); |
||
34 | } |
||
35 | } |
||
36 |