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.

WhoopsMiddleware   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
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 Psr\Http\Message\RequestInterface;
18
use Phossa2\Shared\Base\ObjectAbstract;
19
use Psr\Http\Message\ResponseInterface;
20
use Franzl\Middleware\Whoops\WhoopsRunner;
21
use Phossa2\Middleware\Interfaces\DelegateInterface;
22
use Phossa2\Middleware\Interfaces\MiddlewareInterface;
23
24
/**
25
 * WhoopsMiddleware
26
 *
27
 * Using "franzl/whoops-middleware" for Whoops
28
 *
29
 * @package Phossa2\Middleware
30
 * @author  Hong Zhang <[email protected]>
31
 * @version 2.1.0
32
 * @since   2.1.0 added
33
 */
34
class WhoopsMiddleware extends ObjectAbstract implements MiddlewareInterface
35
{
36
    /**
37
     * Should be the very first middleware in the queue
38
     *
39
     * {@inheritDoc}
40
     */
41
    public function process(
42
        RequestInterface $request,
43
        ResponseInterface $response,
44
        DelegateInterface $next = null
45
    ) {
46
        try {
47
            if ($next) {
48
                return $next->next($request, $response);
49
            }
50
            return $response;
51
        } catch (\Exception $e) {
52
            return WhoopsRunner::handle($e, $request);
53
        }
54
    }
55
}
56