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

RemoteClaimSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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