@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | |
| 21 | 21 | if (isset($this->index)) { |
| 22 | - return parent::setBody(['query' => "FLUSH RTINDEX ".$this->index]); |
|
| 22 | + return parent::setBody(['query' => "FLUSH RTINDEX " . $this->index]); |
|
| 23 | 23 | } |
| 24 | 24 | throw new RuntimeException('Index name is missing.'); |
| 25 | 25 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | public function setBody($params = null) |
| 23 | 23 | { |
| 24 | 24 | if (isset($this->index)) { |
| 25 | - return parent::setBody(['query' => "SHOW INDEX ".$this->index. " SETTINGS"]); |
|
| 25 | + return parent::setBody(['query' => "SHOW INDEX " . $this->index . " SETTINGS"]); |
|
| 26 | 26 | } |
| 27 | 27 | throw new RuntimeException('Index name is missing.'); |
| 28 | 28 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | if (isset($this->index)) { |
| 19 | 19 | return parent::setBody(['query' => "DROP TABLE " . |
| 20 | - (isset($params['silent']) && $params['silent']===true?' IF EXISTS ':''). |
|
| 20 | + (isset($params['silent']) && $params['silent'] === true ? ' IF EXISTS ' : '') . |
|
| 21 | 21 | $this->index]); |
| 22 | 22 | } |
| 23 | 23 | throw new RuntimeException('Missing index name in /indices/drop'); |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | public function setBody($params = null) |
| 23 | 23 | { |
| 24 | 24 | if (isset($this->index)) { |
| 25 | - return parent::setBody(['query' => "SHOW INDEX ".$this->index. " STATUS". |
|
| 26 | - (isset($params['pattern'])?" LIKE '".$params['pattern']."'":"")]); |
|
| 25 | + return parent::setBody(['query' => "SHOW INDEX " . $this->index . " STATUS" . |
|
| 26 | + (isset($params['pattern']) ? " LIKE '" . $params['pattern'] . "'" : "")]); |
|
| 27 | 27 | } |
| 28 | 28 | throw new RuntimeException('Index name is missing.'); |
| 29 | 29 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public $retries; |
| 27 | 27 | |
| 28 | - public $retries_attempts =0; |
|
| 28 | + public $retries_attempts = 0; |
|
| 29 | 29 | |
| 30 | 30 | public function __construct(array $connections, SelectorInterface $strategy, int $retries) |
| 31 | 31 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function getConnection(): Connection |
| 53 | 53 | { |
| 54 | 54 | $this->retries_attempts++; |
| 55 | - $connection = $this->strategy->getConnection($this->connections); |
|
| 55 | + $connection = $this->strategy->getConnection($this->connections); |
|
| 56 | 56 | if ($connection->isAlive()) { |
| 57 | 57 | return $connection; |
| 58 | 58 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function __construct($params = []) |
| 34 | 34 | { |
| 35 | - if (count($params)>0) { |
|
| 35 | + if (count($params) > 0) { |
|
| 36 | 36 | $this->setBody($params['body'] ?? []); |
| 37 | 37 | $this->setQuery($params['query'] ?? []); |
| 38 | 38 | $this->setContentType($params['content_type'] ?? 'application/json'); |
@@ -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[] = "'" . self::escape($params['query']) . "'"; |
| 18 | 18 | $binds[] = "'" . $this->index . "'"; |
| 19 | 19 | if (count($params['options']) > 0) { |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | public function __construct($client) |
| 38 | 38 | { |
| 39 | 39 | $this->client = $client; |
| 40 | - $this->params =['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 40 | + $this->params = ['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function agentstatus($params = []) |
| 44 | 44 | { |
| 45 | - $body = $params['body']??[]; |
|
| 45 | + $body = $params['body'] ?? []; |
|
| 46 | 46 | $endpoint = new AgentStatus(); |
| 47 | 47 | $endpoint->setBody($body); |
| 48 | 48 | $response = $this->client->request($endpoint, $this->params); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public function flushattributes($params = []) |
| 98 | 98 | { |
| 99 | - $body = $params['body']??[]; |
|
| 99 | + $body = $params['body'] ?? []; |
|
| 100 | 100 | $endpoint = new FlushAttributes(); |
| 101 | 101 | $endpoint->setBody($body); |
| 102 | 102 | $response = $this->client->request($endpoint, $this->params); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function flushhostnames($params = []) |
| 107 | 107 | { |
| 108 | - $body = $params['body']??[]; |
|
| 108 | + $body = $params['body'] ?? []; |
|
| 109 | 109 | $endpoint = new FlushHostnames(); |
| 110 | 110 | $endpoint->setBody($body); |
| 111 | 111 | $response = $this->client->request($endpoint, $this->params); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public function flushlogs($params = []) |
| 116 | 116 | { |
| 117 | - $body = $params['body']??[]; |
|
| 117 | + $body = $params['body'] ?? []; |
|
| 118 | 118 | $endpoint = new FlushLogs(); |
| 119 | 119 | $endpoint->setBody($body); |
| 120 | 120 | $response = $this->client->request($endpoint, $this->params); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public function plugins($params = []) |
| 125 | 125 | { |
| 126 | - $body = $params['body']??[]; |
|
| 126 | + $body = $params['body'] ?? []; |
|
| 127 | 127 | $endpoint = new Plugins(); |
| 128 | 128 | $endpoint->setBody($body); |
| 129 | 129 | $response = $this->client->request($endpoint, $this->params); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function reloadindexes($params = []) |
| 134 | 134 | { |
| 135 | - $body = $params['body']??[]; |
|
| 135 | + $body = $params['body'] ?? []; |
|
| 136 | 136 | $endpoint = new ReloadIndexes(); |
| 137 | 137 | $endpoint->setBody($body); |
| 138 | 138 | $response = $this->client->request($endpoint, $this->params); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function reloadplugins($params = []) |
| 143 | 143 | { |
| 144 | - $body = $params['body']??[]; |
|
| 144 | + $body = $params['body'] ?? []; |
|
| 145 | 145 | $endpoint = new ReloadPlugins(); |
| 146 | 146 | $endpoint->setBody($body); |
| 147 | 147 | $response = $this->client->request($endpoint, $this->params); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function status($params = []) |
| 165 | 165 | { |
| 166 | - $body = $params['body']??[]; |
|
| 166 | + $body = $params['body'] ?? []; |
|
| 167 | 167 | $endpoint = new Status(); |
| 168 | 168 | $endpoint->setBody($body); |
| 169 | 169 | $response = $this->client->request($endpoint, $this->params); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | public function tables($params = []) |
| 174 | 174 | { |
| 175 | - $body = $params['body']??[]; |
|
| 175 | + $body = $params['body'] ?? []; |
|
| 176 | 176 | $endpoint = new Tables(); |
| 177 | 177 | $endpoint->setBody($body); |
| 178 | 178 | $response = $this->client->request($endpoint, $this->params); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | public function threads($params = []) |
| 183 | 183 | { |
| 184 | - $body = $params['body']??[]; |
|
| 184 | + $body = $params['body'] ?? []; |
|
| 185 | 185 | $endpoint = new Threads(); |
| 186 | 186 | $endpoint->setBody($body); |
| 187 | 187 | $response = $this->client->request($endpoint, $this->params); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | public function variables($params = []) |
| 192 | 192 | { |
| 193 | - $body = $params['body']??[]; |
|
| 193 | + $body = $params['body'] ?? []; |
|
| 194 | 194 | $endpoint = new Variables(); |
| 195 | 195 | $endpoint->setBody($body); |
| 196 | 196 | $response = $this->client->request($endpoint, $this->params); |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function getDocsMatched($docs) |
| 16 | 16 | { |
| 17 | - return array_map(function ($v) use ($docs) { |
|
| 18 | - return $docs[$v - 1]; |
|
| 17 | + return array_map(function($v) use ($docs) { |
|
| 18 | + return $docs[$v-1]; |
|
| 19 | 19 | }, $this->data['fields']['_percolator_document_slot']); |
| 20 | 20 | } |
| 21 | 21 | } |