Passed
Push — master ( 15dae9...698027 )
by Julito
12:28
created

BaseController::getHomeBreadCrumb()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 18
rs 9.9666
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Controller;
5
6
use Chamilo\CoreBundle\Entity\Course;
7
use Knp\Menu\FactoryInterface as MenuFactoryInterface;
8
use Knp\Menu\ItemInterface as MenuItemInterface;
9
use Knp\Menu\Renderer\ListRenderer;
10
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
11
use Symfony\Bundle\TwigBundle\TwigEngine;
12
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
13
14
/**
15
 * Each entity controller must extends this class.
16
 *
17
 * @abstract
18
 */
19
abstract class BaseController extends Controller
20
{
21
    /**
22
     * @return NotFoundHttpException
23
     */
24
    public function abort()
25
    {
26
        return new NotFoundHttpException();
27
    }
28
29
    /**
30
     * Translator shortcut.
31
     *
32
     * @param string $variable
33
     *
34
     * @return string
35
     */
36
    public function trans($variable)
37
    {
38
        return $this->container->get('translator')->trans($variable);
39
    }
40
41
    /**
42
     * @return MenuFactoryInterface
43
     */
44
    public function getMenuFactory()
45
    {
46
        return $this->container->get('knp_menu.factory');
47
    }
48
49
    /**
50
     * @return Course
51
     */
52
    public function getCourse()
53
    {
54
        return $this->getRequest()->getSession()->get('course');
55
    }
56
}
57