Failed Conditions
Push — issue#702_rs ( ed72a1...cdafcf )
by Guilherme
07:33
created

RemoteClaimSubscriber::__construct()   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
nc 1
nop 1
dl 0
loc 3
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
    public function __construct(RemoteClaimManagerInterface $remoteClaimManager)
32
    {
33
        $this->remoteClaimManager = $remoteClaimManager;
34
    }
35
36
    public static function getSubscribedEvents()
37
    {
38
        return [
39
            RemoteClaimEvents::REMOTE_CLAIM_UPDATE_URI => 'onRemoteClaimUriUpdate',
40
        ];
41
    }
42
43
    public function onRemoteClaimUriUpdate(UpdateRemoteClaimUriEvent $event)
44
    {
45
        $this->remoteClaimManager->updateRemoteClaimUri($event->getClaimName(), $event->getNewUri());
46
    }
47
}
48