Passed
Push — master ( 3ec415...9f2f47 )
by Daniel
16:25
created

LogoutListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 12
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\Security\EventListener;
15
16
use Silverback\ApiComponentsBundle\RefreshToken\Storage\RefreshTokenStorageInterface;
17
use Symfony\Component\Security\Http\Event\LogoutEvent;
18
19
/**
20
 * @author Daniel West <[email protected]>
21
 */
22
class LogoutListener
23
{
24
    private RefreshTokenStorageInterface $storage;
25
26
    public function __construct(RefreshTokenStorageInterface $storage)
27
    {
28
        $this->storage = $storage;
29
    }
30
31
    public function __invoke(LogoutEvent $event): void
32
    {
33
        $this->storage->expireAll($event->getToken()->getUser());
34
    }
35
}
36