RouteController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 48
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A format() 0 4 1
A getClass() 0 4 1
A getMethod() 0 4 1
A prepare() 0 8 1
1
<?php
2
3
namespace Preetender\Routing;
4
5
/**
6
 * Class RouteController
7
 * @package Preetender\Routing
8
 */
9
class RouteController
10
{
11
    /** @var array  */
12
    protected static $param = [];
13
14
    /**
15
     * Format string and split into layers
16
     * @param $param
17
     * @return mixed
18
     */
19
    public static function format($param)
20
    {
21
        static::$param = explode('@', $param);
22
    }
23
24
    /**
25
     * Return class name
26
     *
27
     * @return string
28
     */
29
    public static function getClass() : string
30
    {
31
        return static::$param[0];
32
    }
33
34
    /**
35
     * Retorna method name
36
     *
37
     * @return string
38
     */
39
    public static function getMethod(): string
40
    {
41
        return static::$param[1];
42
    }
43
44
    /**
45
     * @param string $param
46
     * @return array
47
     */
48
    public static function prepare(string $param)
49
    {
50
        static::format($param);
51
        return [
52
            'class' => RouteController::getClass(),
53
            'method' => RouteController::getMethod()
54
        ];
55
    }
56
}
57