SitemapController::siteMap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller;
6
7
use App\Repository\CityRepository;
8
use App\Repository\PropertyRepository;
9
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10
use Symfony\Component\HttpFoundation\Response;
11
use Symfony\Component\Routing\Annotation\Route;
12
13
final class SitemapController extends AbstractController
14
{
15
    /**
16
     * @Route("/sitemap.xml", name="sitemap", defaults={"_format"="xml"})
17
     */
18
    public function siteMap(): Response
19
    {
20
        return $this->render('sitemap/sitemap.xml.twig', []);
21
    }
22
23
    /**
24
     * @Route("/sitemap/cities.xml", name="cities_sitemap", defaults={"_format"="xml"})
25
     */
26
    public function cities(CityRepository $cityRepository): Response
27
    {
28
        $cities = $cityRepository->findAll();
29
30
        return $this->render('sitemap/cities.xml.twig', [
31
            'cities' => $cities,
32
        ]);
33
    }
34
35
    /**
36
     * @Route("/sitemap/properties.xml", name="properties_sitemap", defaults={"_format"="xml"})
37
     */
38
    public function properties(PropertyRepository $propertyRepository): Response
39
    {
40
        $properties = $propertyRepository->findAllPublished();
41
42
        return $this->render('sitemap/properties.xml.twig', [
43
            'properties' => $properties,
44
        ]);
45
    }
46
}
47