1 | <?php |
||
12 | class Controller |
||
13 | { |
||
14 | |||
15 | use DynamicGlobal; |
||
16 | |||
17 | /** |
||
18 | * @var string $layout |
||
19 | */ |
||
20 | public $layout = 'main'; |
||
21 | |||
22 | /** |
||
23 | * @var string $response |
||
24 | */ |
||
25 | public $response; |
||
26 | |||
27 | |||
28 | public function __construct() |
||
32 | |||
33 | public function before() {} |
||
34 | |||
35 | /** |
||
36 | * Compile output |
||
37 | */ |
||
38 | public function __destruct() |
||
44 | |||
45 | /** |
||
46 | * Build variables and display output html |
||
47 | */ |
||
48 | protected function make() |
||
84 | |||
85 | public function after() {} |
||
86 | |||
87 | /** |
||
88 | * Set single global variable |
||
89 | * @param string $var |
||
90 | * @param string $value |
||
91 | * @param bool $html |
||
92 | */ |
||
93 | public function setGlobalVar($var, $value, $html = false) |
||
97 | |||
98 | /** |
||
99 | * Set global variables as array key=>value |
||
100 | * @param $array |
||
101 | */ |
||
102 | public function setGlobalVarArray(array $array) |
||
106 | |||
107 | /** |
||
108 | * Special method to set response of action execution |
||
109 | * @param string $response |
||
110 | */ |
||
111 | public function setResponse($response) |
||
115 | |||
116 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
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.