Failed Conditions
Push — preview-1.19.0 ( 7438ce...cca8d0 )
by Guilherme
12:04
created

RemoteClaimSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 4 1
A __construct() 0 3 1
A onRemoteClaimUriUpdate() 0 3 1
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\RemoteClaimsBundle\EventSubscriber;
12
13
use LoginCidadao\LogBundle\Traits\LoggerAwareTrait;
14
use LoginCidadao\RemoteClaimsBundle\Event\UpdateRemoteClaimUriEvent;
15
use LoginCidadao\RemoteClaimsBundle\Model\RemoteClaimManagerInterface;
16
use LoginCidadao\RemoteClaimsBundle\RemoteClaimEvents;
17
use Psr\Log\LoggerAwareInterface;
18
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
19
20
class RemoteClaimSubscriber implements EventSubscriberInterface, LoggerAwareInterface
21
{
22
    use LoggerAwareTrait;
23
24
    /** @var RemoteClaimManagerInterface */
25
    private $remoteClaimManager;
26
27
    /**
28
     * AuthorizationSubscriber constructor.
29
     * @param RemoteClaimManagerInterface $remoteClaimManager
30
     */
31 1
    public function __construct(RemoteClaimManagerInterface $remoteClaimManager)
32
    {
33 1
        $this->remoteClaimManager = $remoteClaimManager;
34 1
    }
35
36 15
    public static function getSubscribedEvents()
37
    {
38
        return [
39 15
            RemoteClaimEvents::REMOTE_CLAIM_UPDATE_URI => 'onRemoteClaimUriUpdate',
40
        ];
41
    }
42
43 1
    public function onRemoteClaimUriUpdate(UpdateRemoteClaimUriEvent $event)
44
    {
45 1
        $this->remoteClaimManager->updateRemoteClaimUri($event->getClaimName(), $event->getNewUri());
46 1
    }
47
}
48