Passed
Pull Request — master (#5790)
by Angel Fernando Quiroz
25:02 queued 17:19
created

ContainerHelper::getSession()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\ServiceHelper;
8
9
use Symfony\Component\HttpFoundation\Session\SessionFactoryInterface;
10
use Symfony\Component\HttpFoundation\Session\SessionInterface;
11
use Symfony\Component\HttpKernel\KernelInterface;
12
use Symfony\Component\Messenger\MessageBusInterface;
13
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
14
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
15
use Symfony\Component\Validator\Validator\ValidatorInterface;
16
17
class ContainerHelper
18
{
19
    private AuthorizationCheckerInterface $authorizationChecker;
20
    private TokenStorageInterface $tokenStorage;
21
    private KernelInterface $kernel;
22
    private MessageBusInterface $messengerBus;
23
    private ValidatorInterface $validator;
24
    private SessionFactoryInterface $sessionFactory;
25
26
    public function getAuthorizationChecker(): AuthorizationCheckerInterface
27
    {
28
        return $this->authorizationChecker;
29
    }
30
31
    public function setAuthorizationChecker(AuthorizationCheckerInterface $authorizationChecker): void
32
    {
33
        $this->authorizationChecker = $authorizationChecker;
34
    }
35
36
    public function getTokenStorage(): TokenStorageInterface
37
    {
38
        return $this->tokenStorage;
39
    }
40
41
    public function setTokenStorage(TokenStorageInterface $tokenStorage): void
42
    {
43
        $this->tokenStorage = $tokenStorage;
44
    }
45
46
    public function getKernel(): KernelInterface
47
    {
48
        return $this->kernel;
49
    }
50
51
    public function setKernel(KernelInterface $kernel): void
52
    {
53
        $this->kernel = $kernel;
54
    }
55
56
    public function getMessengerBus(): MessageBusInterface
57
    {
58
        return $this->messengerBus;
59
    }
60
61
    public function setMessengerBus(MessageBusInterface $messengerBus): void
62
    {
63
        $this->messengerBus = $messengerBus;
64
    }
65
66
    public function getValidator(): ValidatorInterface
67
    {
68
        return $this->validator;
69
    }
70
71
    public function setValidator(ValidatorInterface $validator): void
72
    {
73
        $this->validator = $validator;
74
    }
75
76
    public function getSession(): SessionInterface
77
    {
78
        return $this->sessionFactory->createSession();
79
    }
80
81
    public function setSessionFactory(SessionFactoryInterface $sessionFactory): ContainerHelper
82
    {
83
        $this->sessionFactory = $sessionFactory;
84
85
        return $this;
86
    }
87
}
88