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.
Completed
Push — master ( 1ff583...9f27fd )
by Hong
03:00
created

Phossa2SessionMiddleware   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A before() 0 6 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
    public function __construct(SessionInterface $session)
40
    {
41
        $this->session = $session;
42
43
        // set as default session
44
        Carton::setDefaultSession($this->session);
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     */
50
    protected function before(
51
        RequestInterface $request,
52
        ResponseInterface $response
53
    )/* : ResponseInterface */ {
54
        return $response;
55
    }
56
57
    /**
58
     * Doing nothing afterwards
59
     *
60
     * {@inheritDoc}
61
     */
62
    protected function after(
63
        RequestInterface $request,
64
        ResponseInterface $response
65
    )/* : ResponseInterface */ {
66
        $this->session->close();
67
        return $response;
68
    }
69
}
70