Completed
Push — master ( 527bb5...aca9c3 )
by César
05:15
created

RouteController::prepare()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 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 $param
46
     * @return array
47
     */
48
    public static function prepare($param)
49
    {
50
        $format = static::format($param);
0 ignored issues
show
Unused Code introduced by
$format is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
51
        return [
52
            'class' => RouteController::getClass(),
53
            'method' => RouteController::getMethod()
54
        ];
55
    }
56
}
57