DebugListener   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 43
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 8 1
A setResponseFactory() 0 3 1
1
<?php
2
3
namespace Happyr\ApiBundle\Security\Firewall;
4
5
use Happyr\ApiBundle\Service\ResponseFactory;
6
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
7
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
8
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
9
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
10
use Happyr\ApiBundle\Security\Authentication\Token\WsseUserToken;
11
12
/**
13
 * @author Tobias Nyholm <[email protected]>
14
 */
15
class DebugListener implements ListenerInterface
16
{
17
    /**
18
     * @var TokenStorageInterface
19
     */
20
    protected $tokenStorage;
21
22
    /**
23
     * @var AuthenticationManagerInterface
24
     */
25
    protected $authenticationManager;
26
27
    /**
28
     * WsseListener constructor.
29
     *
30
     * @param TokenStorageInterface          $tokenStorage
31
     * @param AuthenticationManagerInterface $authenticationManager
32
     */
33
    public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager)
34
    {
35
        $this->tokenStorage = $tokenStorage;
36
        $this->authenticationManager = $authenticationManager;
37
    }
38
39
    /**
40
     * @param GetResponseEvent $event
41
     */
42
    public function handle(GetResponseEvent $event)
43
    {
44
        $token = new WsseUserToken();
45
        $token->setUser('api_user');
46
47
        $authToken = $this->authenticationManager->authenticate($token);
48
        $this->tokenStorage->setToken($authToken);
49
    }
50
51
    /**
52
     * @param ResponseFactory $responseFactory
53
     **/
54
    public function setResponseFactory(ResponseFactory $responseFactory)
0 ignored issues
show
Unused Code introduced by
The parameter $responseFactory is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
    }
57
}
58