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 ( 5c5c4b...19a2b9 )
by Quim
02:25
created

RequestResponseDispatcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace QuimCalpe\Router\Dispatcher;
3
4
use QuimCalpe\Router\Route\ParsedRoute;
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
use RuntimeException;
8
9
class RequestResponseDispatcher implements DispatcherInterface
10
{
11
    /**
12
     * @var Request
13
     */
14
    private $request;
15
16
    /**
17
     * @param Request $request
18
     */
19 5
    public function __construct(Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
20
    {
21 5
        $this->request = $request;
22 5
    }
23
24
    /**
25
     * @param ParsedRoute $route
26
     * @return Response
27
     *
28
     * @throws RuntimeException
29
     */
30 5
    public function handle(ParsedRoute $route)
31
    {
32 5
        $segments = explode("::", $route->controller());
33 5
        $controller = $segments[0];
34 5
        $action = count($segments) > 1 ? $segments[1] : "index";
35 5
        if (method_exists($controller, $action)) {
36 4
            $params = [$this->request, new Response(), $route->params()];
37 4
            return call_user_func_array([new $controller(), $action], $params);
38
        } else {
39 1
            throw new RuntimeException("No method {$action} in controller {$segments[0]}");
40
        }
41
    }
42
}
43