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.

RouteDefinition::isAuth()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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
class RouteDefinition
8
{
9
    /**
10
     * @var string
11
     */
12
    private $name;
13
14
    /**
15
     * @var string
16
     */
17
    private $pathRegex;
18
    /**
19
     * @var array
20
     */
21
    private $requirements;
22
    /**
23
     * @var array
24
     */
25
    private $defaults = ['controller' => 'Default', 'action' => 'notFound'];
26
    /**
27
     * @var bool
28
     */
29
    private $auth;
30
    /**
31
     * @var array
32
     */
33
    private $params;
34
35
    /**
36
     * undocumented function.
37
     */
38 16
    public function __construct(string $name, string $pathRegex, array $requirements = [], array $defaults = [], bool $auth = false, array $params = [])
39
    {
40 16
        $this->name = $name;
41 16
        $this->pathRegex = $pathRegex;
42 16
        $this->requirements = $requirements;
43 16
        $this->defaults = array_merge($this->defaults, $defaults);
44 16
        $this->auth = $auth;
45 16
        $this->params = $params;
46 16
    }
47
48 2
    public function getName(): string
49
    {
50 2
        return $this->name;
51
    }
52
53 6
    public function getPathRegex(): string
54
    {
55 6
        return $this->pathRegex;
56
    }
57
58 6
    public function getRequirements(): array
59
    {
60 6
        return $this->requirements;
61
    }
62
63 1
    public function getDefaults(): array
64
    {
65 1
        return $this->defaults;
66
    }
67
68 1
    public function setDefaults(array $defaults = [])
69
    {
70 1
        $this->defaults = $defaults;
71 1
    }
72
73 2
    public function getDefault($name)
74
    {
75 2
        return isset($this->defaults[$name]) ? $this->defaults[$name] : false;
76
    }
77
78
    public function addDefaults(array $defaults)
79
    {
80
        foreach ($defaults as $name => $default) {
81
            $this->defaults[$name] = $default;
82
        }
83
    }
84
85 1
    public function isAuth(): bool
86
    {
87 1
        return $this->auth;
88
    }
89
90
    public function getParams(): array
91
    {
92
        return $this->params;
93
    }
94
95
    public function getParam($name)
96
    {
97
        return isset($this->params[$name]) ? $this->params[$name] : false;
98
    }
99
}
100