1 | <?php |
||
7 | class CachedConfigCollection implements ConfigCollectionInterface |
||
8 | { |
||
9 | /** |
||
10 | * @const string |
||
11 | */ |
||
12 | const METADATA_KEY = '__METADATA__'; |
||
13 | |||
14 | /** |
||
15 | * @const string |
||
16 | */ |
||
17 | const HISTORY_KEY = '__HISTORY__'; |
||
18 | |||
19 | /** |
||
20 | * @var CacheItemPoolInterface |
||
21 | */ |
||
22 | protected $pool; |
||
23 | |||
24 | /** |
||
25 | * @var boolean |
||
26 | */ |
||
27 | protected $trackMetadata = false; |
||
28 | |||
29 | /** |
||
30 | * @param boolean $trackMetadata |
||
31 | * @param CacheItemPoolInterface $pool |
||
32 | */ |
||
33 | 4 | public function __construct(CacheItemPoolInterface $pool, $trackMetadata = false) |
|
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 3 | public function set($key, $value, $metadata = []) |
|
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 1 | public function get($key) |
|
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 2 | public function exists($key) |
|
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 1 | public function delete($key) |
|
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | 1 | public function deleteAll() |
|
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | 2 | public function getMetadata() |
|
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | 2 | public function getHistory() |
|
130 | |||
131 | /** |
||
132 | * A shortcut for tracking data (metadata and history). This will |
||
133 | * always return an array, even if we're not tracking. |
||
134 | * |
||
135 | * @param string $key |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | 2 | private function getTrackingData($key) |
|
150 | |||
151 | /** |
||
152 | * Saves the metadata to cache |
||
153 | * |
||
154 | * @param array $metadata |
||
155 | */ |
||
156 | 1 | protected function saveMetadata($metadata) |
|
163 | |||
164 | /** |
||
165 | * Saves the history to the cache |
||
166 | * |
||
167 | * @param array $history |
||
168 | */ |
||
169 | 1 | protected function saveHistory($history) |
|
176 | |||
177 | /** |
||
178 | * Commits the cache |
||
179 | */ |
||
180 | 4 | public function __destruct() |
|
184 | } |
||
185 |
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.