Conditions | 8 |
Paths | 8 |
Total Lines | 28 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | public function setBody($params = null) |
||
19 | { |
||
20 | if (isset($this->cluster)) { |
||
21 | if (isset($params['operation'])) { |
||
22 | switch ($params['operation']) { |
||
23 | case 'add': |
||
24 | if (isset($params['index'])) { |
||
25 | return parent::setBody(['query' => "ALTER CLUSTER " . |
||
26 | $this->cluster . " ADD " . $params['index']]); |
||
27 | } |
||
28 | throw new RuntimeException('Index name is missing.'); |
||
29 | break; |
||
30 | case 'drop': |
||
31 | if (isset($params['index'])) { |
||
32 | return parent::setBody(['query' => "ALTER CLUSTER " . |
||
33 | $this->cluster . " DROP " . $params['index']]); |
||
34 | } |
||
35 | throw new RuntimeException('Index name is missing.'); |
||
36 | break; |
||
37 | case 'update': |
||
38 | return parent::setBody(['query' => "ALTER CLUSTER " .$this->cluster . " UPDATE nodes"]); |
||
39 | break; |
||
|
|||
40 | } |
||
41 | throw new RuntimeException('Unknown cluster operation'); |
||
42 | } |
||
43 | throw new RuntimeException('Cluster operation is missing'); |
||
44 | } |
||
45 | throw new RuntimeException('Cluster name is missing.'); |
||
46 | } |
||
64 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.