Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
SitemapController | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
xmlSitemap | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
sitemap | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Controller; |
4 | |
5 | use Olz\Components\OlzHtmlSitemap\OlzHtmlSitemap; |
6 | use Olz\Components\OlzXmlSitemap\OlzXmlSitemap; |
7 | use Olz\Utils\HttpUtils; |
8 | use Psr\Log\LoggerInterface; |
9 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
10 | use Symfony\Component\HttpFoundation\Request; |
11 | use Symfony\Component\HttpFoundation\Response; |
12 | use Symfony\Component\Routing\Annotation\Route; |
13 | |
14 | class SitemapController extends AbstractController { |
15 | #[Route('/sitemap.xml')] |
16 | public function xmlSitemap( |
17 | Request $request, |
18 | LoggerInterface $logger, |
19 | OlzXmlSitemap $olzXmlSitemap, |
20 | ): Response { |
21 | $response = new Response($olzXmlSitemap->getHtml([])); |
22 | $response->headers->set('Content-Type', 'application/xml'); |
23 | return $response; |
24 | } |
25 | |
26 | #[Route('/sitemap')] |
27 | public function sitemap( |
28 | Request $request, |
29 | LoggerInterface $logger, |
30 | HttpUtils $httpUtils, |
31 | OlzHtmlSitemap $olzHtmlSitemap, |
32 | ): Response { |
33 | $httpUtils->countRequest($request); |
34 | return new Response($olzHtmlSitemap->getHtml([])); |
35 | } |
36 | } |