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 ( 22a5b0...86b256 )
by Patrique
01:37
created

Router::resolve()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 9.8333
cc 3
nc 3
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Patoui\Router;
6
7
class Router
8
{
9
    /* @var array<Routable> */
10
    private $routes;
11
12
    public function addRoute(Routable $routable) : void
13
    {
14
        $this->routes[] = $routable;
15
    }
16
17
    public function getRoutes() : array
18
    {
19
        return $this->routes;
20
    }
21
22
    /**
23
     * @param  string  $httpVerb
24
     * @param  string  $path
25
     * @return mixed
26
     * @throws RouteNotFoundException
27
     */
28
    public function resolve(string $httpVerb, string $path)
29
    {
30
        /* @var $route Routable */
31
        foreach ($this->routes as $route) {
32
            if ($route->isHttpVerbAndPathAMatch($httpVerb, $path)) {
33
                return $route->resolve();
34
            }
35
        }
36
37
        throw new RouteNotFoundException(
38
            "Route path '{$path}' with http verb '{$httpVerb}'"
39
        );
40
    }
41
}
42