Passed
Push — master ( 8276d9...eeb046 )
by Julito
11:16
created

BaseController::getResourceRepositoryFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Controller;
6
7
use Chamilo\CoreBundle\Block\BreadcrumbBlockService;
8
use Chamilo\CoreBundle\Component\Utils\Glide;
9
use Chamilo\CoreBundle\Repository\ResourceFactory;
10
use Knp\Menu\FactoryInterface as MenuFactoryInterface;
11
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
12
use Symfony\Contracts\Translation\TranslatorInterface;
13
14
/**
15
 * Each entity controller must extends this class.
16
 *
17
 * @abstract
18
 */
19
abstract class BaseController extends AbstractController
20
{
21
    protected $translator;
22
23
    public static function getSubscribedServices(): array
24
    {
25
        $services = parent::getSubscribedServices();
26
        $services['translator'] = TranslatorInterface::class;
27
        $services['breadcrumb'] = BreadcrumbBlockService::class;
28
        $services['resource_factory'] = ResourceFactory::class;
29
        $services['glide'] = Glide::class;
30
31
        return $services;
32
    }
33
34
    public function getResourceRepositoryFactory(): ResourceFactory
35
    {
36
        return $this->container->get('resource_factory');
37
    }
38
39
    public function getBreadCrumb(): BreadcrumbBlockService
40
    {
41
        return $this->container->get('breadcrumb');
42
    }
43
44
    /**
45
     * @return MenuFactoryInterface
46
     */
47
    public function getMenuFactory()
48
    {
49
        return $this->container->get('knp_menu.factory');
50
    }
51
52
    /**
53
     * @return Glide
54
     */
55
    public function getGlide()
56
    {
57
        return $this->container->get('glide');
58
    }
59
}
60