Passed
Pull Request — master (#101)
by Łukasz
05:01
created

DeactivateUserListener::onDeactivation()   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
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminSecurityBundle\EventListener;
11
12
use FSi\Bundle\AdminSecurityBundle\Event\ActivationEvent;
13
use FSi\Bundle\AdminSecurityBundle\Event\AdminSecurityEvents;
14
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
16
class DeactivateUserListener implements EventSubscriberInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public static function getSubscribedEvents()
22
    {
23
        return [
24
            AdminSecurityEvents::DEACTIVATION => 'onDeactivation'
25
        ];
26
    }
27
28
    /**
29
     * @param ActivationEvent $event
30
     */
31
    public function onDeactivation(ActivationEvent $event)
32
    {
33
        $event->getUser()->setEnabled(false);
34
    }
35
}
36