Passed
Push — master ( e769ca...f1e182 )
by Stone
04:38
created

TrickHistoryController   A

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\Routing\Annotation\Route;
10
11
/**
12
 * Class TrickHistoryController
13
 * @package App\Controller\Trick\Admin
14
 * @IsGranted("ROLE_ADMIN")
15
 */
16
class TrickHistoryController extends AbstractController
17
{
18
19
    /**
20
     * @var TrickHistory
21
     */
22
    private $trickHistory;
23
24
    public function __construct(TrickHistory $trickHistory)
25
    {
26
        $this->trickHistory = $trickHistory;
27
    }
28
29
    /**
30
     * @Route("/trick/edit/history/{id}", name="trick.history")
31
     * @return \Symfony\Component\HttpFoundation\Response
32
     */
33
    public function index(Trick $trick)
34
    {
35
36
        $history = $this->trickHistory->getHistory($trick->getId());
37
38
        return $this->render('trick/admin/trick-history.html.twig', [
39
            'trick' => $trick,
40
            'history' => $history,
41
        ]);
42
    }
43
}
44