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.

RouteCollection   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 27
ccs 8
cts 11
cp 0.7272
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 2
A add() 0 8 2
A all() 0 3 1
A count() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lib\Routing;
6
7
class RouteCollection
8
{
9
    protected $routes = [];
10
11 8
    public function add(string $name, RouteDefinition $route)
12
    {
13 8
        if (!isset($this->routes['$name'])) {
14 8
            $this->routes[$name] = $route;
15
16 8
            return true;
17
        }
18
        throw new \InvalidArgumentException("The route {$name} already exists.");
19
    }
20
21
    public function get($name)
22
    {
23
        return isset($this->routes[$name]) ? $this->routes[$name] : false;
24
    }
25
26 6
    public function all()
27
    {
28 6
        return $this->routes;
29
    }
30
31 2
    public function count()
32
    {
33 2
        return \count($this->routes);
34
    }
35
}
36