DefaultController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2017 Francois-Xavier Soubirou.
4
 *
5
 * This file is part of ci-report.
6
 *
7
 * ci-report is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * ci-report is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with ci-report. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
declare(strict_types=1);
21
22
namespace App\Controller;
23
24
use App\Entity\Campaign;
25
use App\Entity\Status;
26
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
27
use Symfony\Component\HttpFoundation\Response;
28
use Symfony\Component\Routing\Annotation\Route;
29
30
/**
31
 * Default controller class.
32
 *
33
 * @category  ci-report app
34
 *
35
 * @author    Francois-Xavier Soubirou <[email protected]>
36
 * @copyright 2017 Francois-Xavier Soubirou
37
 * @license   http://www.gnu.org/licenses/   GPLv3
38
 *
39
 * @see      https://www.ci-report.io
40
 */
41
class DefaultController extends Controller
42
{
43
    /**
44
     * Index action.
45
     *
46
     * @return Response A Response instance
47
     *
48
     * @Route("/", name="homepage")
49
     */
50
    public function indexAction(): Response
51
    {
52
        $campaigns = $this->getDoctrine()
53
            ->getRepository(Campaign::class)
54
            ->findLastRawCampaignForEveryProjects();
55
56
        return $this->render(
57
            'default/index.html.twig',
58
            array(
59
                'campaigns' => $campaigns,
60
                'status' => new Status(),
61
            )
62
        );
63
    }
64
}
65