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

LogoutHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A logout() 0 3 1
A __construct() 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\Http\Logout;
15
16
use Silverback\ApiComponentsBundle\RefreshToken\Storage\RefreshTokenStorageInterface;
17
use Symfony\Component\HttpFoundation\Request;
18
use Symfony\Component\HttpFoundation\Response;
19
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
20
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
21
22
/**
23
 * @deprecated As of Symfony 5.1 implement an event listener instead. Will be removed when supported symfony versions >=5.1
24
 */
25
final class LogoutHandler implements LogoutHandlerInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Symfony\Component\Securi...\LogoutHandlerInterface has been deprecated: since Symfony 5.1 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

25
final class LogoutHandler implements /** @scrutinizer ignore-deprecated */ LogoutHandlerInterface

This interface has been deprecated. The supplier of the interface has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.

Loading history...
26
{
27
    private RefreshTokenStorageInterface $storage;
28
29
    public function __construct(RefreshTokenStorageInterface $storage)
30
    {
31
        $this->storage = $storage;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function logout(Request $request, Response $response, TokenInterface $token): void
38
    {
39
        $this->storage->expireAll($token->getUser());
40
    }
41
}
42