@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function toArray() |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - return $this->_toArray($this->_params); |
|
| 17 | + return $this->_toArray($this->_params); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function _toArray($params) |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | protected $_params; |
| 10 | 10 | |
| 11 | - public function add($k,$v) { |
|
| 11 | + public function add($k, $v) { |
|
| 12 | 12 | $this->_params[$k] = $v; |
| 13 | 13 | } |
| 14 | 14 | public function toArray() |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | } elseif (is_array($v)) { |
| 27 | 27 | $return[$k] = $this->_toArray($v); |
| 28 | 28 | } else { |
| 29 | - if($v!==null) { |
|
| 29 | + if ($v !== null) { |
|
| 30 | 30 | $return[$k] = $v; |
| 31 | - }else { |
|
| 31 | + } else { |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } else { |
| 29 | 29 | if($v!==null) { |
| 30 | 30 | $return[$k] = $v; |
| 31 | - }else { |
|
| 31 | + } else { |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct($keywords, $fields) |
| 12 | 12 | { |
| 13 | - $this->_params['match'] =[$fields => $keywords]; |
|
| 13 | + $this->_params['match'] = [$fields => $keywords]; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function must($args):self |
| 12 | 12 | { |
| 13 | - $this->_params['must'][]= $args; |
|
| 13 | + $this->_params['must'][] = $args; |
|
| 14 | 14 | return $this; |
| 15 | 15 | } |
| 16 | 16 | public function mustNot($args):self |
| 17 | 17 | { |
| 18 | - $this->_params['must_not'][]= $args; |
|
| 18 | + $this->_params['must_not'][] = $args; |
|
| 19 | 19 | return $this; |
| 20 | 20 | } |
| 21 | 21 | public function should($args):self |
| 22 | 22 | { |
| 23 | - $this->_params['should'][]= $args; |
|
| 23 | + $this->_params['should'][] = $args; |
|
| 24 | 24 | return $this; |
| 25 | 25 | } |
| 26 | 26 | public function toArray() |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Equals extends Query |
| 10 | 10 | { |
| 11 | - public function __construct($field,$args) |
|
| 11 | + public function __construct($field, $args) |
|
| 12 | 12 | { |
| 13 | 13 | $this->_params['equals'] = [$field => $args]; |
| 14 | 14 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Range extends Query |
| 10 | 10 | { |
| 11 | - public function __construct($field,$args=[]) |
|
| 11 | + public function __construct($field, $args = []) |
|
| 12 | 12 | { |
| 13 | 13 | $this->_params['range'] = [$field => $args]; |
| 14 | 14 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->_query->must(new QueryString($string)); |
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | - public function match($keywords,$fields=null):self |
|
| 67 | + public function match($keywords, $fields = null):self |
|
| 68 | 68 | { |
| 69 | 69 | $f = "*"; |
| 70 | 70 | if ($fields !== null && is_string($fields)) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->_query->must(new Match($keywords, $f)); |
| 74 | 74 | return $this; |
| 75 | 75 | } |
| 76 | - public function phrase($string,$fields=null):self |
|
| 76 | + public function phrase($string, $fields = null):self |
|
| 77 | 77 | { |
| 78 | 78 | $f = "*"; |
| 79 | 79 | if ($fields !== null && is_string($fields)) { |
@@ -118,12 +118,12 @@ |
||
| 118 | 118 | return $this->_client->indices()->create($params); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function drop($silent=false) |
|
| 121 | + public function drop($silent = false) |
|
| 122 | 122 | { |
| 123 | 123 | $params = [ |
| 124 | 124 | 'index' => $this->_index, |
| 125 | 125 | ]; |
| 126 | - if($silent===true) { |
|
| 126 | + if ($silent === true) { |
|
| 127 | 127 | $params['body'] = ['silent'=>true]; |
| 128 | 128 | } |
| 129 | 129 | return $this->_client->indices()->drop($params); |