SitemapController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A cities() 0 6 1
A siteMap() 0 3 1
A properties() 0 6 1
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