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

CurrentTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A currentAction() 0 4 1
A current() 0 4 1
A getCurrent() 0 3 1
A currentName() 0 4 1
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