CurrentTrait::currentAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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