@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | if (isset($this->_index)) { |
24 | 24 | $columns = []; |
25 | - if(isset($params['columns'] )) { |
|
25 | + if (isset($params['columns'])) { |
|
26 | 26 | foreach ($params['columns'] as $name => $settings) { |
27 | 27 | $column = $name . ' ' . $settings['type']; |
28 | 28 | if (isset($settings['options']) && count($settings['options']) > 0) { |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | $options = ""; |
35 | - if(isset($params['settings'] )) { |
|
36 | - foreach($params['settings'] as $name=>$value) { |
|
37 | - $options.=" ".$name." = '".$value."'"; |
|
35 | + if (isset($params['settings'])) { |
|
36 | + foreach ($params['settings'] as $name=>$value) { |
|
37 | + $options .= " " . $name . " = '" . $value . "'"; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | } |
41 | - return parent::setBody(['query' => "CREATE TABLE ". |
|
42 | - (isset($params['silent']) && $params['silent']===true?' IF NOT EXISTS ':''). |
|
43 | - $this->_index. |
|
44 | - (count($columns)>0?"(".implode(",",$columns).")":" ") |
|
41 | + return parent::setBody(['query' => "CREATE TABLE " . |
|
42 | + (isset($params['silent']) && $params['silent'] === true ? ' IF NOT EXISTS ' : '') . |
|
43 | + $this->_index . |
|
44 | + (count($columns) > 0 ? "(" . implode(",", $columns) . ")" : " ") |
|
45 | 45 | .$options]); |
46 | 46 | } |
47 | 47 | throw new RuntimeException('Index name is missing.'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function setBody($params = null) |
16 | 16 | { |
17 | 17 | if (isset($this->_index)) { |
18 | - $binds =[]; |
|
18 | + $binds = []; |
|
19 | 19 | $binds[] = "'" . Utils::escape($params['query']) . "'"; |
20 | 20 | $binds[] = "'" . $this->_index . "'"; |
21 | 21 | if (count($params['options']) > 0) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $binds[] = "$value AS $name"; |
24 | 24 | } |
25 | 25 | } |
26 | - return parent::setBody( ['query' => "CALL KEYWORDS(" . implode(",", $binds) . ")"]); |
|
26 | + return parent::setBody(['query' => "CALL KEYWORDS(" . implode(",", $binds) . ")"]); |
|
27 | 27 | } |
28 | 28 | throw new RuntimeException('Index name is missing.'); |
29 | 29 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function setBody($params = null) |
15 | 15 | { |
16 | 16 | if (isset($this->_index)) { |
17 | - $binds =[]; |
|
17 | + $binds = []; |
|
18 | 18 | $binds[] = "'" . Utils::escape($params['query']) . "'"; |
19 | 19 | $binds[] = "'" . $this->_index . "'"; |
20 | 20 | if (count($params['options']) > 0) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $binds[] = "$value AS $name"; |
23 | 23 | } |
24 | 24 | } |
25 | - return parent::setBody( ['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
25 | + return parent::setBody(['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
26 | 26 | } |
27 | 27 | throw new RuntimeException('Index name is missing.'); |
28 | 28 | } |