TrickHistoryController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 8 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Controller\Trick\Admin;
4
5
use App\Entity\Trick;
6
use App\History\TrickHistory;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
8
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9
use Symfony\Component\HttpFoundation\Response;
10
use Symfony\Component\Routing\Annotation\Route;
11
12
/**
13
 * Class TrickHistoryController
14
 * @package App\Controller\Trick\Admin
15
 * @IsGranted("ROLE_ADMIN")
16
 */
17
class TrickHistoryController extends AbstractController
18
{
19
20
    /**
21
     * @var TrickHistory
22
     */
23
    private $trickHistory;
24
25
    public function __construct(TrickHistory $trickHistory)
26
    {
27
        $this->trickHistory = $trickHistory;
28
    }
29
30
    /**
31
     * @Route("/trick/edit/history/{id}", name="trick.history")
32
     * @return Response
33
     */
34
    public function index(Trick $trick)
35
    {
36
37
        $history = $this->trickHistory->getHistory($trick->getId());
38
39
        return $this->render('trick/admin/trick-history.html.twig', [
40
            'trick' => $trick,
41
            'history' => $history,
42
        ]);
43
    }
44
}
45