CityController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 11
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller;
6
7
use App\Entity\City;
8
use App\Service\CityService;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
use Symfony\Component\Routing\Annotation\Route;
12
13
final class CityController extends BaseController
14
{
15
    /**
16
     * @Route("/city/{slug}", defaults={"page": "1"}, methods={"GET"}, name="city")
17
     */
18
    public function index(Request $request, City $city, CityService $service): Response
19
    {
20
        $searchParams = $service->getSearchParams($request, $city);
21
        $properties = $service->getProperties($searchParams);
22
        $siteOptions = $service->decorateOptions($this->site($request), $city);
23
24
        return $this->render('property/index.html.twig',
25
            [
26
                'site' => $siteOptions,
27
                'properties' => $properties,
28
                'searchParams' => $searchParams,
29
            ]
30
        );
31
    }
32
}
33