Completed
Pull Request — master (#394)
by Wesley
03:51
created

ContextInvalidationSessionLogoutHandler::logout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCacheBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
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
namespace FOS\HttpCacheBundle\Security\Http\Logout;
13
14
use FOS\HttpCacheBundle\UserContextInvalidator;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpFoundation\Response;
17
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
18
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
19
20
class ContextInvalidationSessionLogoutHandler implements LogoutHandlerInterface
21
{
22
    private $invalidator;
23
24 1
    public function __construct(UserContextInvalidator $invalidator)
25
    {
26 1
        $this->invalidator = $invalidator;
27 1
    }
28
29 1
    public function logout(Request $request, Response $response, TokenInterface $token)
30
    {
31 1
        $this->invalidator->invalidateContext($request->getSession()->getId());
32 1
        $request->getSession()->invalidate();
33 1
    }
34
}
35