SessionWrite   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 2
1
<?php
2
3
namespace T4web\Authentication\Listener;
4
5
use Zend\Session\SessionManager;
6
use T4web\Authentication\AuthenticationEvent;
7
use T4web\Authentication\Exception\RuntimeException;
8
9
class SessionWrite
10
{
11
    /**
12
     * @var SessionManager
13
     */
14
    protected $sessionManager;
15
16
    /**
17
     * @param SessionManager $sessionManager
18
     * @throws RuntimeException
19
     */
20
    public function __construct(SessionManager $sessionManager)
21
    {
22
        $this->sessionManager = $sessionManager;
23
    }
24
25
    public function __invoke(AuthenticationEvent $e)
26
    {
27
        $result = $e->getResult();
28
29
        if ($result->isValid()) {
30
            $this->sessionManager->writeClose();
31
        }
32
    }
33
}
34