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 ( 2f9e73...76a949 )
by Patrique
02:20
created

Router::getRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Patoui\Router;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
9
class Router
10
{
11
    /* @var array<Routable> */
12
    private $routes;
13
14
    public function __construct()
15
    {
16
        $this->routes = [];
17
    }
18
19
    public function addRoute(Routable $routable) : void
20
    {
21
        $this->routes[] = $routable;
22
    }
23
24
    /**
25
     * @return array
26
     */
27
    public function getRoutes() : array
28
    {
29
        return $this->routes;
30
    }
31
32
    /**
33
     * @param  ServerRequestInterface $serverRequest
34
     * @return mixed TODO: should be Routable but php-psalm throwing errors.
35
     * @throws RouteNotFoundException
36
     */
37
    public function resolve(ServerRequestInterface $serverRequest)
38
    {
39
        /* @var $route Routable */
40
        foreach ($this->routes as $route) {
41
            if ($route->isHttpVerbAndPathAMatch($serverRequest->getMethod(), $serverRequest->getRequestTarget())) {
42
                return $route;
43
            }
44
        }
45
46
        throw new RouteNotFoundException('Route not found');
47
    }
48
}
49