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 ( 8446f9...1ff583 )
by Hong
03:11
created

WhoopsMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
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
            return $next->next($request, $response);
0 ignored issues
show
Bug introduced by
It seems like $next is not always an object, but can also be of type null. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
48
        } catch (\Exception $e) {
49
            return WhoopsRunner::handle($e, $request);
50
        }
51
    }
52
}
53