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.

Router::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lib\Routing;
6
7
use Psr\Http\Message\RequestInterface;
8
9
class Router
10
{
11
    /**
12
     * @var UrlMatcher
13
     */
14
    private $matcher;
15
    /**
16
     * @var RouteLoader
17
     */
18
    private $loader;
19
20 3
    public function __construct(RouteLoader $loader = null, UrlMatcher $matcher = null)
21
    {
22 3
        $this->loader = $loader ?? new RouteLoader();
23 3
        $collection = $this->loader->loadRoutes();
24 3
        $this->matcher = $matcher ?? new UrlMatcher($collection);
25 3
    }
26
27 3
    public function route(RequestInterface $request)
28
    {
29 3
        return $this->matcher->match($request->getUri()->getPath());
30
    }
31
}
32