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

Helper::loadByArray()   A

Complexity

Conditions 5
Paths 6

Size

Total Lines 33
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 17
c 1
b 0
f 0
nc 6
nop 0
dl 0
loc 33
rs 9.3888
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