| Conditions | 5 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function validate($page, Constraint $constraint) |
||
| 21 | { |
||
| 22 | if (!$constraint instanceof PageRendering) { |
||
| 23 | throw new UnexpectedTypeException($constraint, PageRendering::class); |
||
| 24 | } |
||
| 25 | |||
| 26 | if (false !== $page->getRedirection()) { // si c'est une redir, on check rien |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | |||
| 30 | $template = null !== $page->getTemplate() ? $page->getTemplate() : $this->defaultPageTemplate; |
||
| 31 | |||
| 32 | try { |
||
| 33 | $this->twig->render($template, ['page' => $page]); |
||
| 34 | } catch (\Exception $exception) { |
||
| 35 | $this->context->buildViolation($constraint->message) |
||
| 36 | ->addViolation(); |
||
| 37 | } |
||
| 40 |