1 | <?php |
||
7 | class EsIndexSwitcher |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * |
||
12 | * @var Client |
||
13 | */ |
||
14 | private $client; |
||
15 | |||
16 | /** |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | private $alias; |
||
21 | |||
22 | /** |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private $indexPrefix; |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $indexSuffix; |
||
33 | |||
34 | 8 | public function __construct(Client $client, string $alias, string $indexPrefix, string $indexSuffix = null) |
|
48 | |||
49 | /** |
||
50 | * |
||
51 | * @return Client |
||
52 | */ |
||
53 | 8 | public function getClient() |
|
57 | |||
58 | /** |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 3 | public function getAlias() |
|
66 | |||
67 | /** |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 8 | public function getIndexPrefix() |
|
75 | |||
76 | /** |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 7 | public function getIndexSuffix() |
|
84 | |||
85 | /** |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | 7 | public function getNewIndexName() |
|
93 | |||
94 | /** |
||
95 | * |
||
96 | * @param array $indexBody |
||
97 | * @return array |
||
98 | */ |
||
99 | 2 | public function createNewIndex(array $indexBody = []) |
|
109 | |||
110 | /** |
||
111 | * |
||
112 | * @return void |
||
113 | */ |
||
114 | 1 | public function finish() |
|
131 | |||
132 | /** |
||
133 | * |
||
134 | * @return array |
||
135 | */ |
||
136 | 2 | private function updateAlias() |
|
155 | |||
156 | /** |
||
157 | * |
||
158 | * @return array |
||
159 | */ |
||
160 | 2 | private function fetchCurrentIndices() |
|
168 | |||
169 | /** |
||
170 | * |
||
171 | * @param array $indices |
||
172 | * @return array |
||
173 | */ |
||
174 | 2 | private function removeOldIndices(array $indices) |
|
193 | } |
||
194 |
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.