Passed
Branch v2-dev (262be0)
by Henri
01:28
created

CurrentTrait::getCurrent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace HnrAzevedo\Router;
4
5
trait CurrentTrait
6
{
7
    use Helper;
8
9
    protected array $currentRoute = [];
10
11
    public static function current(): array
12
    {
13
        self::getInstance()->hasCurrentRoute();
14
        return self::getInstance()->getCurrent();
15
    }
16
17
    public static function currentName(): string
18
    {
19
        self::getInstance()->hasCurrentRoute();
20
        return self::getInstance()->getCurrent()['name'];
21
    }
22
23
    public static function currentAction()
24
    {
25
        self::getInstance()->hasCurrentRoute();
26
        return self::getInstance()->getCurrent()['action'];
27
    }
28
29
    protected function getCurrent(): array
30
    {
31
        return $this->currentRoute;
32
    }
33
    
34
}
35