CurrentTrait   A
last analyzed

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
declare(strict_types = 1);
4
5
namespace HnrAzevedo\Router;
6
7
trait CurrentTrait
8
{
9
    use Helper;
10
11
    protected array $currentRoute = [];
12
13
    public static function current(): array
14
    {
15
        self::getInstance()->hasCurrentRoute();
16
        return self::getInstance()->getCurrent();
17
    }
18
19
    public static function currentName(): string
20
    {
21
        self::getInstance()->hasCurrentRoute();
22
        return self::getInstance()->getCurrent()['name'];
23
    }
24
25
    public static function currentAction()
26
    {
27
        self::getInstance()->hasCurrentRoute();
28
        return self::getInstance()->getCurrent()['action'];
29
    }
30
31
    protected function getCurrent(): array
32
    {
33
        return $this->currentRoute;
34
    }
35
    
36
}
37