Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function validate($value, Constraint $constraint): void |
||
31 | { |
||
32 | $routes = $this->router->getRouteCollection(); |
||
33 | /* @var \Symfony\Component\Routing\Route $route */ |
||
34 | foreach ($routes as $name => $route) { |
||
35 | if ($route->getPath() === '/'.$value) { |
||
36 | if ($this->showRoute) { |
||
37 | $this->context->addViolation($constraint->message, ['{{ route }}' => $name]); |
||
38 | } else { |
||
39 | $this->context->addViolation($constraint->messageWithoutRoute); |
||
40 | } |
||
41 | break; |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |