GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Phossa2SessionMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A after() 0 7 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Middleware
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Middleware\Middleware;
16
17
use Phossa2\Session\Carton;
18
use Psr\Http\Message\RequestInterface;
19
use Psr\Http\Message\ResponseInterface;
20
use Phossa2\Session\Interfaces\SessionInterface;
21
22
/**
23
 * Phossa2SessionMiddleware
24
 *
25
 * @package Phossa2\Middleware
26
 * @author  Hong Zhang <[email protected]>
27
 * @see     MiddlewareAbstract
28
 * @version 2.1.0
29
 * @since   2.1.0 added
30
 */
31
class Phossa2SessionMiddleware extends MiddlewareAbstract
32
{
33
    /**
34
     * @var    SessionInterface
35
     * @access protected
36
     */
37
    protected $session;
38
39
    /**
40
     * Inject the session object
41
     *
42
     * @param  SessionInterface $session
43
     * @access public
44
     */
45
    public function __construct(SessionInterface $session)
46
    {
47
        $this->session = $session;
48
49
        // set as default session
50
        Carton::setDefaultSession($this->session);
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    protected function after(
57
        RequestInterface $request,
58
        ResponseInterface $response
59
    )/* : ResponseInterface */ {
60
        $this->session->close();
61
        return $response;
62
    }
63
}
64