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

Helper::explodeRoutes()   A

Complexity

Conditions 6
Paths 16

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 9
nc 16
nop 4
dl 0
loc 17
rs 9.2222
c 1
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