1 | <?php |
||
12 | class MetadataManager implements MetadataManagerInterface |
||
13 | { |
||
14 | /** |
||
15 | * Structures metadata parser |
||
16 | * |
||
17 | * @var MetadataParserInterface |
||
18 | */ |
||
19 | private $parser; |
||
20 | /** |
||
21 | * Structures metadata cache |
||
22 | * |
||
23 | * @var Cache |
||
24 | */ |
||
25 | private $cache; |
||
26 | /** |
||
27 | * Structures metadata |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $metadata = []; |
||
32 | /** |
||
33 | * Prefix for cache entries for structure metadata |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $cachePrefix = 'StructMetadata_'; |
||
38 | |||
39 | /** |
||
40 | * Get structure metadata information for given structure |
||
41 | * |
||
42 | * @param string|StructInterface $struct Either structure class name or instance of structure object |
||
43 | * to get metadata for |
||
44 | * @throws \InvalidArgumentException |
||
45 | * @return StructMetadata|null |
||
46 | */ |
||
47 | 188 | public function getMetadata($struct) |
|
96 | |||
97 | /** |
||
98 | * Get cache key for given class |
||
99 | * |
||
100 | * @param string $class |
||
101 | * @return string |
||
102 | */ |
||
103 | 182 | protected function getCacheKey($class) |
|
107 | |||
108 | /** |
||
109 | * Get metadata cache |
||
110 | * |
||
111 | * @return Cache |
||
112 | */ |
||
113 | 184 | public function getCache() |
|
120 | |||
121 | /** |
||
122 | * Set metadata cache |
||
123 | * |
||
124 | * @param Cache $cache |
||
125 | * @return $this |
||
126 | */ |
||
127 | 6 | public function setCache(Cache $cache) |
|
132 | |||
133 | /** |
||
134 | * Get metadata parser |
||
135 | * |
||
136 | * @return MetadataParserInterface |
||
137 | */ |
||
138 | 185 | public function getParser() |
|
148 | |||
149 | /** |
||
150 | * Set metadata parser |
||
151 | * |
||
152 | * @param MetadataParserInterface $parser |
||
153 | * @return $this |
||
154 | */ |
||
155 | 7 | public function setParser(MetadataParserInterface $parser) |
|
163 | } |
||
164 |
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.