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 ( 17370b...216ab3 )
by Benjamin
02:35
created

RouteLoader::loadRoutes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 11
nc 2
nop 0
dl 0
loc 17
ccs 12
cts 12
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Lib\Routing;
4
5
use Symfony\Component\Yaml\Parser;
6
7
class RouteLoader
8
{
9
    /**
10
     * @var string
11
     */
12
    private $rootDir;
13
    /**
14
     * @var string
15
     */
16
    private $routeFile;
17
18
    /**
19
     * @var Parser
20
     */
21
    private $parser;
22
23 4
    public function __construct(string $path = null)
24
    {
25 4
        $path = $path ?? '/config/routes.yml';
26 4
        list($scriptName) = get_included_files();
27
28 4
        $this->rootDir   = dirname(realpath($scriptName));
29 4
        $this->routeFile = "{$this->rootDir}{$path}";
30 4
        $this->parser    = new Parser();
31 4
    }
32
33 4
    public function loadRoutes()
34
    {
35 4
        $routes    = new RouteCollection();
36 4
        $routesArr = $this->parser->parseFile($this->routeFile);
37
38 4
        foreach ($routesArr as $name => $row) {
39 4
            $path         = $row['path'];
40 4
            $requirements = $row['requirements'] ?? [];
41 4
            $defaults     = $row['defaults'] ?? [];
42 4
            $auth         = $row['auth'] ?? false;
43 4
            $params       = $row['params'] ?? [];
44
45 4
            $route = new RouteDefinition($name, $path, $requirements, $defaults, $auth, $params);
46 4
            $routes->add($name, $route);
47
        }
48
49 4
        return $routes;
50
    }
51
}
52