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

ContextInvalidationSessionLogoutHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A logout() 0 5 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