Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4.0047 |
1 | <?php |
||
14 | 4 | public static function validate($data, $parameter, SubSchemaValidatorFactory $validatorFactory, $pointer = null) |
|
15 | { |
||
16 | 4 | if (!is_array($parameter)) { |
|
17 | return null; |
||
18 | } |
||
19 | |||
20 | 4 | foreach ($parameter as $schema) { |
|
21 | 4 | $validator = $validatorFactory->makeSubSchemaValidator($data, $schema, $pointer); |
|
22 | 4 | if ($validator->passes()) { |
|
23 | 4 | return null; |
|
24 | } |
||
25 | 4 | } |
|
26 | 4 | return new ValidationError( |
|
27 | 4 | 'Failed matching any of the provided schemas.', |
|
28 | 4 | ErrorCode::ANY_OF_SCHEMA, |
|
29 | 4 | $data, |
|
30 | 4 | $pointer, |
|
31 | 4 | ['any_of' => $parameter] |
|
32 | 4 | ); |
|
33 | } |
||
34 | } |
||
35 |