Passed
Branch v2-dev (0ddf7c)
by Henri
10:02
created

Helper::Controller()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 22
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 4
eloc 13
nc 6
nop 1
dl 0
loc 22
rs 9.8333
c 2
b 0
f 0
1
<?php
2
3
namespace HnrAzevedo\Router;
4
5
trait Helper
6
{
7
    protected static Router $instance;
8
9
    public static function getInstance(): RouterInterface
10
    {
11
        self::$instance = (!isset(self::$instance)) ? new Router() : self::$instance;
12
        return self::$instance;
13
    }
14
15
    protected static function updateRoute(array $route, $key): RouterInterface
16
    {
17
        self::getInstance()->routes[$key] = $route;
0 ignored issues
show
Bug introduced by
The property routes is declared protected in HnrAzevedo\Router\Router and cannot be accessed from this context.
Loading history...
18
        return self::getInstance();
19
    }
20
21
    protected function inSave(): array
22
    {
23
        return end($this->routes);
24
    }
25
26
}
27