1 | <?php |
||
6 | class Config |
||
7 | { |
||
8 | /** |
||
9 | * Loaded Configuration Items |
||
10 | * |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $configuration = []; |
||
14 | |||
15 | /** |
||
16 | * Path to Configuration Folder |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $path; |
||
21 | |||
22 | /** |
||
23 | * Configuration file extension |
||
24 | */ |
||
25 | const CONFIG_FILE_EXTENSION = ".php"; |
||
26 | |||
27 | /** |
||
28 | * Config constructor. |
||
29 | * |
||
30 | * @param $configFolderPath |
||
31 | */ |
||
32 | public function __construct($configFolderPath) |
||
36 | |||
37 | /** |
||
38 | * Sets the configuration folder path |
||
39 | * |
||
40 | * @param $path |
||
41 | */ |
||
42 | protected function setPath($path) |
||
46 | |||
47 | /** |
||
48 | * Loads a configuration file in to memory |
||
49 | * |
||
50 | * @param $key |
||
51 | * @return bool |
||
52 | */ |
||
53 | protected function loadConfigFile(string $key) : bool |
||
65 | |||
66 | /** |
||
67 | * Get Configuration Item |
||
68 | * |
||
69 | * @param $key |
||
70 | * |
||
71 | * @return \stdClass |
||
72 | * @throws ConfigException when config file not found |
||
73 | */ |
||
74 | public function get(string $key) |
||
87 | |||
88 | /** |
||
89 | * @param string $key |
||
90 | * @param $value mixed array|string |
||
91 | */ |
||
92 | public function set(string $key, $value) |
||
97 | } |
||
98 |
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.