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

SimpleDispatcher::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4286
cc 3
eloc 9
nc 4
nop 1
crap 3
1
<?php
2
namespace QuimCalpe\Router\Dispatcher;
3
4
use QuimCalpe\Router\Route\ParsedRoute;
5
use RuntimeException;
6
7
class SimpleDispatcher implements DispatcherInterface
8
{
9
    /**
10
     * @param ParsedRoute $route
11
     * @return string
12
     *
13
     * @throws RuntimeException
14
     */
15 4
    public function handle(ParsedRoute $route)
16
    {
17 4
        $segments = explode("::", $route->controller());
18 4
        $controller = $segments[0];
19 4
        $action = count($segments) > 1 ? $segments[1] : "index";
20 4
        if (method_exists($controller, $action)) {
21 3
            $params = [$route->params()];
22 3
            return call_user_func_array([new $controller, $action], $params);
23
        } else {
24 1
            throw new RuntimeException("No method {$action} in controller {$segments[0]}");
25
        }
26
    }
27
}
28