Total Complexity | 10 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | class Alter extends EmulateBySql |
||
11 | { |
||
12 | use Utils; |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $cluster; |
||
17 | |||
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 | } |
||
47 | |||
48 | /** |
||
49 | * @return mixed |
||
50 | */ |
||
51 | public function getCLuster() |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param mixed $cluster |
||
58 | */ |
||
59 | public function setCluster($cluster) |
||
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.