Completed
Pull Request — 4.0 (#4082)
by akira
07:49
created

AdminLogoutHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A logout() 0 6 2
1
<?php
2
3
namespace Eccube\Security\Http\Logout;
4
5
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpFoundation\Response;
8
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
9
use Symfony\Component\HttpFoundation\Session\SessionInterface;
10
11
class AdminLogoutHandler implements LogoutHandlerInterface {
12
13
    private $session;
14
15
    public function __construct(SessionInterface $session)
16
    {
17
        $this->session = $session;
18
    }
19
20
    public function logout(Request $request, Response $response, TokenInterface $token)
21
    {
22
        if ($this->session->has("_security_admin")) {
23
            $this->session->remove("_security_admin");
24
        }
25
    }
26
27
}
28