Conditions | 9 |
Paths | 5 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | public function setBody($params = null) |
||
22 | { |
||
23 | if (isset($this->_index)) { |
||
24 | $columns = []; |
||
25 | if(isset($params['columns'] )) { |
||
26 | foreach ($params['columns'] as $name => $settings) { |
||
27 | $column = $name . ' ' . $settings['type']; |
||
28 | if (isset($settings['options']) && count($settings['options']) > 0) { |
||
29 | $column .= ' ' . implode(' ', $settings['options']); |
||
30 | } |
||
31 | $columns[] = $column; |
||
32 | } |
||
33 | } |
||
34 | $options = ""; |
||
35 | if(isset($params['settings'] )) { |
||
36 | foreach($params['settings'] as $name=>$value) { |
||
37 | $options.=" ".$name." = ".$value; |
||
38 | } |
||
39 | |||
40 | } |
||
41 | return parent::setBody(['query' => "CREATE TABLE ".$this->_index. |
||
42 | (count($columns)>0?"(".implode(",",$columns).")":" ") |
||
43 | .$options]); |
||
44 | } |
||
45 | throw new RuntimeException('Index name is missing.'); |
||
46 | } |
||
63 | } |