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

LogoutHandler::logout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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