@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | public function highlight($fields = [], $settings = []): self |
| 144 | 144 | { |
| 145 | 145 | |
| 146 | - if (count($fields) === 0 && count($settings)===0) { |
|
| 147 | - $this->params['highlight'] = new \stdClass(); |
|
| 146 | + if (count($fields) === 0 && count($settings) === 0) { |
|
| 147 | + $this->params['highlight'] = new \stdClass(); |
|
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | $this->params['highlight'] = []; |
| 151 | 151 | if (count($fields) > 0) { |
| 152 | - $this->params['highlight']['fields'] =$fields; |
|
| 152 | + $this->params['highlight']['fields'] = $fields; |
|
| 153 | 153 | } |
| 154 | - if (count($settings)>0) { |
|
| 154 | + if (count($settings) > 0) { |
|
| 155 | 155 | foreach ($settings as $name => $value) { |
| 156 | - $this->params['highlight'][$name] =$value; |
|
| 156 | + $this->params['highlight'][$name] = $value; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | return $this; |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | $group = $field; |
| 261 | 261 | } |
| 262 | 262 | $terms = ['field'=>$field]; |
| 263 | - if ($limit !==null) { |
|
| 263 | + if ($limit !== null) { |
|
| 264 | 264 | $terms['size'] = $limit; |
| 265 | 265 | } |
| 266 | 266 | $this->params['aggs'][$group] = ['terms' =>$terms]; |
| 267 | 267 | if ($sortField !== null) { |
| 268 | - $this->params['aggs'][$group]['sort'] = [ [$sortField => $sortDirection] ]; |
|
| 268 | + $this->params['aggs'][$group]['sort'] = [[$sortField => $sortDirection]]; |
|
| 269 | 269 | } |
| 270 | 270 | return $this; |
| 271 | 271 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function setBody($params = null) |
| 14 | 14 | { |
| 15 | 15 | if (isset($this->index)) { |
| 16 | - $binds =[]; |
|
| 16 | + $binds = []; |
|
| 17 | 17 | $binds[] = "'" . static::escape($params['query']) . "'"; |
| 18 | 18 | $binds[] = "'" . $this->index . "'"; |
| 19 | 19 | if (count($params['options']) > 0) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | curl_setopt($conn, CURLOPT_CUSTOMREQUEST, $method); |
| 57 | 57 | curl_setopt($conn, CURLOPT_HTTPHEADER, $headers); |
| 58 | 58 | |
| 59 | - if ($connection->getConnectTimeout()>0) { |
|
| 59 | + if ($connection->getConnectTimeout() > 0) { |
|
| 60 | 60 | curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, $connection->getConnectTimeout()); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | curl_setopt( |
| 66 | 66 | $conn, |
| 67 | 67 | CURLOPT_USERPWD, |
| 68 | - $connection->getConfig('username').":".$connection->getConfig('password') |
|
| 68 | + $connection->getConfig('username') . ":" . $connection->getConfig('password') |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | if ($connection->getConfig('proxy') !== null) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $status = curl_getinfo($conn, CURLINFO_HTTP_CODE); |
| 86 | 86 | if (isset($params['responseClass'])) { |
| 87 | 87 | $responseClass = $params['responseClass']; |
| 88 | - $responseClassParams = isset($params['responseClassParams'])?$params['responseClassParams']:[]; |
|
| 88 | + $responseClassParams = isset($params['responseClassParams']) ? $params['responseClassParams'] : []; |
|
| 89 | 89 | $response = new $responseClass($responseString, $status, $responseClassParams); |
| 90 | 90 | } else { |
| 91 | 91 | $response = new Response($responseString, $status); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | 'body' => $request->getBody() |
| 100 | 100 | ]); |
| 101 | 101 | //hard error |
| 102 | - if ($errorno>0) { |
|
| 102 | + if ($errorno > 0) { |
|
| 103 | 103 | $error = curl_error($conn); |
| 104 | 104 | |
| 105 | 105 | static::$curl = null; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function setBody($params = null) |
| 14 | 14 | { |
| 15 | 15 | if (isset($this->index)) { |
| 16 | - $binds =[]; |
|
| 16 | + $binds = []; |
|
| 17 | 17 | $binds[] = "'" . static::escape($params['query']) . "'"; |
| 18 | 18 | $binds[] = "'" . $this->index . "'"; |
| 19 | 19 | if (count($params['options']) > 0) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | static::checkDocumentId($id); |
| 78 | 78 | if (is_object($data)) { |
| 79 | - $data = (array) $data; |
|
| 79 | + $data = (array)$data; |
|
| 80 | 80 | } elseif (is_string($data)) { |
| 81 | 81 | $data = json_decode($data, true); |
| 82 | 82 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $toinsert = []; |
| 100 | 100 | foreach ($documents as $document) { |
| 101 | 101 | if (is_object($document)) { |
| 102 | - $document = (array) $document; |
|
| 102 | + $document = (array)$document; |
|
| 103 | 103 | } elseif (is_string($document)) { |
| 104 | 104 | $document = json_decode($document, true); |
| 105 | 105 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | static::checkDocumentId($id); |
| 214 | 214 | if (is_object($data)) { |
| 215 | - $data = (array) $data; |
|
| 215 | + $data = (array)$data; |
|
| 216 | 216 | } elseif (is_string($data)) { |
| 217 | 217 | $data = json_decode($data, true); |
| 218 | 218 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $toreplace = []; |
| 235 | 235 | foreach ($documents as $document) { |
| 236 | 236 | if (is_object($document)) { |
| 237 | - $document = (array) $document; |
|
| 237 | + $document = (array)$document; |
|
| 238 | 238 | } elseif (is_string($document)) { |
| 239 | 239 | $document = json_decode($document, true); |
| 240 | 240 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | protected static function checkIfList(array &$ids) |
| 456 | 456 | { |
| 457 | - if ($ids && (array_keys($ids) !== range(0, count($ids) - 1))) { |
|
| 457 | + if ($ids && (array_keys($ids) !== range(0, count($ids)-1))) { |
|
| 458 | 458 | $ids = array_values(array_unique($ids)); |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function agentstatus($params = []) |
| 43 | 43 | { |
| 44 | - $body = $params['body']??[]; |
|
| 44 | + $body = $params['body'] ?? []; |
|
| 45 | 45 | $endpoint = new AgentStatus(); |
| 46 | 46 | $endpoint->setBody($body); |
| 47 | 47 | $response = $this->client->request( |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function flushattributes($params = []) |
| 103 | 103 | { |
| 104 | - $body = $params['body']??[]; |
|
| 104 | + $body = $params['body'] ?? []; |
|
| 105 | 105 | $endpoint = new FlushAttributes(); |
| 106 | 106 | $endpoint->setBody($body); |
| 107 | 107 | $response = $this->client->request($endpoint, ['responseClass'=>'Manticoresearch\\Response\\Sql']); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function flushhostnames($params = []) |
| 112 | 112 | { |
| 113 | - $body = $params['body']??[]; |
|
| 113 | + $body = $params['body'] ?? []; |
|
| 114 | 114 | $endpoint = new FlushHostnames(); |
| 115 | 115 | $endpoint->setBody($body); |
| 116 | 116 | $response = $this->client->request($endpoint, $this->params); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function flushlogs($params = []) |
| 121 | 121 | { |
| 122 | - $body = $params['body']??[]; |
|
| 122 | + $body = $params['body'] ?? []; |
|
| 123 | 123 | $endpoint = new FlushLogs(); |
| 124 | 124 | $endpoint->setBody($body); |
| 125 | 125 | $response = $this->client->request($endpoint, $this->params); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | public function plugins($params = []) |
| 130 | 130 | { |
| 131 | - $body = $params['body']??[]; |
|
| 131 | + $body = $params['body'] ?? []; |
|
| 132 | 132 | $endpoint = new Plugins(); |
| 133 | 133 | $endpoint->setBody($body); |
| 134 | 134 | $response = $this->client->request($endpoint, $this->params); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function reloadindexes($params = []) |
| 139 | 139 | { |
| 140 | - $body = $params['body']??[]; |
|
| 140 | + $body = $params['body'] ?? []; |
|
| 141 | 141 | $endpoint = new ReloadIndexes(); |
| 142 | 142 | $endpoint->setBody($body); |
| 143 | 143 | $response = $this->client->request($endpoint, $this->params); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | public function reloadplugins($params = []) |
| 148 | 148 | { |
| 149 | - $body = $params['body']??[]; |
|
| 149 | + $body = $params['body'] ?? []; |
|
| 150 | 150 | $endpoint = new ReloadPlugins(); |
| 151 | 151 | $endpoint->setBody($body); |
| 152 | 152 | $response = $this->client->request($endpoint, $this->params); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function status($params = []) |
| 170 | 170 | { |
| 171 | - $body = $params['body']??[]; |
|
| 171 | + $body = $params['body'] ?? []; |
|
| 172 | 172 | $endpoint = new Status(); |
| 173 | 173 | $endpoint->setBody($body); |
| 174 | 174 | $response = $this->client->request( |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function tables($params = []) |
| 182 | 182 | { |
| 183 | - $body = $params['body']??[]; |
|
| 183 | + $body = $params['body'] ?? []; |
|
| 184 | 184 | $endpoint = new Tables(); |
| 185 | 185 | $endpoint->setBody($body); |
| 186 | 186 | $response = $this->client->request( |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | public function threads($params = []) |
| 194 | 194 | { |
| 195 | - $body = $params['body']??[]; |
|
| 195 | + $body = $params['body'] ?? []; |
|
| 196 | 196 | $endpoint = new Threads(); |
| 197 | 197 | $endpoint->setBody($body); |
| 198 | 198 | $response = $this->client->request($endpoint, $this->params); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | public function variables($params = []) |
| 203 | 203 | { |
| 204 | - $body = $params['body']??[]; |
|
| 204 | + $body = $params['body'] ?? []; |
|
| 205 | 205 | $endpoint = new Variables(); |
| 206 | 206 | $endpoint->setBody($body); |
| 207 | 207 | $response = $this->client->request( |