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

Helper::loadByName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 15
rs 9.9666
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