| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function validate( |
||
| 18 | SchemaInterface $schema, |
||
| 19 | DocumentNode $document, |
||
| 20 | array $rules = [], |
||
| 21 | ?TypeInfo $typeInfo = null |
||
| 22 | ): array { |
||
| 23 | $typeInfo = $typeInfo ?? new TypeInfo($schema); |
||
| 24 | |||
| 25 | $context = new ValidationContext($schema, $document, $typeInfo); |
||
| 26 | |||
| 27 | $visitors = array_map(function (RuleInterface $rule) use ($context) { |
||
| 28 | return $rule->setContext($context); |
||
| 29 | }, $rules ?? specifiedRules()); |
||
| 30 | |||
| 31 | $visitor = new TypeInfoVisitor($typeInfo, new ParallelVisitor($visitors)); |
||
| 32 | |||
| 33 | // Visit the whole document with each instance of all provided rules. |
||
| 34 | $document->accept($visitor); |
||
| 35 | |||
| 36 | return $context->getErrors(); |
||
| 37 | } |
||
| 39 |