Total Complexity | 6 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
25 | class Sitemap |
||
26 | { |
||
27 | /** |
||
28 | * @var RouterInterface |
||
29 | */ |
||
30 | private $router; |
||
31 | |||
32 | /** |
||
33 | * @var EngineInterface |
||
34 | */ |
||
35 | private $templateEngine; |
||
36 | |||
37 | /** |
||
38 | * Sitemap constructor. |
||
39 | * |
||
40 | * @param RouterInterface $router |
||
41 | * @param EngineInterface $templateEngine |
||
42 | */ |
||
43 | public function __construct(RouterInterface $router, EngineInterface $templateEngine) |
||
44 | { |
||
45 | 1 | $this->router = $router; |
|
46 | 1 | $this->templateEngine = $templateEngine; |
|
47 | 1 | } |
|
48 | |||
49 | /** |
||
50 | * @return Response |
||
51 | */ |
||
52 | public function __invoke() : Response |
||
53 | { |
||
54 | 1 | return new Response( |
|
55 | 1 | $this->templateEngine->render( |
|
56 | 1 | 'NorsysSeoBundle::sitemap.xml.twig', |
|
57 | [ |
||
58 | 1 | 'routes' => $this->getExposedRoutes() |
|
59 | ] |
||
60 | ), |
||
61 | 1 | Response::HTTP_OK, |
|
62 | [ |
||
63 | 1 | 'Content-Type' => 'text/xml', |
|
64 | ] |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Return a list of exposed route names |
||
70 | * |
||
71 | * @return array |
||
72 | */ |
||
73 | private function getExposedRoutes() : array |
||
87 | } |
||
88 | } |
||
89 |