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
Branch 1.0 (53c4b5)
by Quim
03:22
created

SimpleDispatcher::handle()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
ccs 11
cts 11
cp 1
rs 9.2
cc 4
eloc 11
nc 6
nop 1
crap 4
1
<?php
2
namespace QuimCalpe\Router\Dispatchers;
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 = [];
22 3
            if (count($route->params())) {
23 1
                $params[] = $route->params();
24 1
            }
25 3
            return call_user_func_array([new $controller, $action], $params);
26
        } else {
27 1
            throw new RuntimeException("No method {$action} in controller {$segments[0]}");
28
        }
29
    }
30
}
31