Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class Create extends EmulateBySql |
||
16 | { |
||
17 | use Utils; |
||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $cluster; |
||
22 | |||
23 | public function setBody($params = null) |
||
24 | { |
||
25 | if (isset($this->cluster)) { |
||
26 | $options = []; |
||
27 | if (isset($params['path'])) { |
||
28 | $options[] = "'" . $params['path'] . "' AS path"; |
||
29 | } |
||
30 | if (isset($params['nodes'])) { |
||
31 | $options[] = "'" . $params['nodes'] . "' AS nodes"; |
||
32 | } |
||
33 | return parent::setBody(['query' => "CREATE CLUSTER " . $this->cluster . |
||
34 | ((count($options) > 0) ? ' ' . implode(',', $options) : '')]); |
||
35 | } |
||
36 | throw new RuntimeException('Cluster name is missing.'); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function getCLuster() |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param mixed $cluster |
||
49 | */ |
||
50 | public function setCluster($cluster) |
||
53 | } |
||
54 | } |
||
55 |