@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function setBody($params = null) |
| 17 | 17 | { |
| 18 | - if(isset($params['name'])) { |
|
| 18 | + if (isset($params['name'])) { |
|
| 19 | 19 | return parent::setBody(['query' => "DROP FUNCTION " . $params['name']]); |
| 20 | 20 | } |
| 21 | 21 | throw new RuntimeException('Missing function name in /nodes/dropfunction'); |
@@ -21,6 +21,6 @@ |
||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return parent::setBody(['query' => "SHOW THREADS " . ((count($options)>0)?' OPTION '.implode(",", $options):'')]); |
|
| 24 | + return parent::setBody(['query' => "SHOW THREADS " . ((count($options) > 0) ? ' OPTION ' . implode(",", $options) : '')]); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function setBody($params = null) |
| 17 | 17 | { |
| 18 | - if(isset($params['name'])) { |
|
| 19 | - return parent::setBody(['query' => "DROP PLUGIN " . $params['name']." TYPE".$params['type']]); |
|
| 18 | + if (isset($params['name'])) { |
|
| 19 | + return parent::setBody(['query' => "DROP PLUGIN " . $params['name'] . " TYPE" . $params['type']]); |
|
| 20 | 20 | } |
| 21 | 21 | throw new RuntimeException('Missing plugin name in /nodes/dropplugin'); |
| 22 | 22 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function __construct($client) |
| 26 | 26 | { |
| 27 | 27 | $this->_client = $client; |
| 28 | - $this->_params =['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 28 | + $this->_params = ['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $endpoint = new Alter(); |
| 37 | 37 | $endpoint->setCluster($cluster); |
| 38 | 38 | $endpoint->setBody($body); |
| 39 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 39 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 40 | 40 | return $response->getResponse(); |
| 41 | 41 | |
| 42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $endpoint = new Create(); |
| 49 | 49 | $endpoint->setCluster($cluster); |
| 50 | 50 | $endpoint->setBody($body); |
| 51 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 51 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 52 | 52 | return $response->getResponse(); |
| 53 | 53 | |
| 54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $endpoint = new Delete(); |
| 61 | 61 | $endpoint->setCluster($cluster); |
| 62 | 62 | $endpoint->setBody($body); |
| 63 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 63 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 64 | 64 | return $response->getResponse(); |
| 65 | 65 | |
| 66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $endpoint = new Join(); |
| 73 | 73 | $endpoint->setCluster($cluster); |
| 74 | 74 | $endpoint->setBody($body); |
| 75 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 75 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 76 | 76 | return $response->getResponse(); |
| 77 | 77 | |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $endpoint = new Set(); |
| 85 | 85 | $endpoint->setCluster($cluster); |
| 86 | 86 | $endpoint->setBody($body); |
| 87 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 87 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 88 | 88 | return $response->getResponse(); |
| 89 | 89 | |
| 90 | 90 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | protected $_response; |
| 37 | 37 | |
| 38 | - public function __construct( $responseString, $status = null) |
|
| 38 | + public function __construct($responseString, $status = null) |
|
| 39 | 39 | { |
| 40 | 40 | if (is_array($responseString)) { |
| 41 | 41 | $this->_response = $responseString; |
@@ -37,15 +37,15 @@ 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 | - public function agentstatus($params=[]) |
|
| 43 | + public function agentstatus($params = []) |
|
| 44 | 44 | { |
| 45 | 45 | $body = $params['body']??[]; |
| 46 | 46 | $endpoint = new AgentStatus(); |
| 47 | 47 | $endpoint->setBody($body); |
| 48 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 48 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 49 | 49 | return $response->getResponse(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $body = $params['body']; |
| 55 | 55 | $endpoint = new CreateFunction(); |
| 56 | 56 | $endpoint->setBody($body); |
| 57 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 57 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 58 | 58 | return $response->getResponse(); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $body = $params['body']; |
| 64 | 64 | $endpoint = new CreatePlugin(); |
| 65 | 65 | $endpoint->setBody($body); |
| 66 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 66 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 67 | 67 | return $response->getResponse(); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $body = $params['body']; |
| 73 | 73 | $endpoint = new Debug(); |
| 74 | 74 | $endpoint->setBody($body); |
| 75 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 75 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 76 | 76 | return $response->getResponse(); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $body = $params['body']; |
| 82 | 82 | $endpoint = new DropFunction(); |
| 83 | 83 | $endpoint->setBody($body); |
| 84 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 84 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 85 | 85 | return $response->getResponse(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,52 +90,52 @@ discard block |
||
| 90 | 90 | $body = $params['body']; |
| 91 | 91 | $endpoint = new DropPlugin(); |
| 92 | 92 | $endpoint->setBody($body); |
| 93 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 93 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 94 | 94 | return $response->getResponse(); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function flushattributes($params=[]) |
|
| 97 | + public function flushattributes($params = []) |
|
| 98 | 98 | { |
| 99 | 99 | $body = $params['body']??[]; |
| 100 | 100 | $endpoint = new FlushAttributes(); |
| 101 | 101 | $endpoint->setBody($body); |
| 102 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 102 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 103 | 103 | return $response->getResponse(); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function flushhostnames($params=[]) |
|
| 106 | + public function flushhostnames($params = []) |
|
| 107 | 107 | { |
| 108 | 108 | $body = $params['body']??[]; |
| 109 | 109 | $endpoint = new FlushHostnames(); |
| 110 | 110 | $endpoint->setBody($body); |
| 111 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 111 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 112 | 112 | return $response->getResponse(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function flushlogs($params=[]) |
|
| 115 | + public function flushlogs($params = []) |
|
| 116 | 116 | { |
| 117 | 117 | $body = $params['body']??[]; |
| 118 | 118 | $endpoint = new FlushLogs(); |
| 119 | 119 | $endpoint->setBody($body); |
| 120 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 120 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 121 | 121 | return $response->getResponse(); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function plugins($params=[]) |
|
| 124 | + public function plugins($params = []) |
|
| 125 | 125 | { |
| 126 | 126 | $body = $params['body']??[]; |
| 127 | 127 | $endpoint = new Plugins(); |
| 128 | 128 | $endpoint->setBody($body); |
| 129 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 129 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 130 | 130 | return $response->getResponse(); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function reloadindexes($params=[]) |
|
| 133 | + public function reloadindexes($params = []) |
|
| 134 | 134 | { |
| 135 | 135 | $body = $params['body']??[]; |
| 136 | 136 | $endpoint = new ReloadIndexes(); |
| 137 | 137 | $endpoint->setBody($body); |
| 138 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 138 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 139 | 139 | return $response->getResponse(); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $body = $params['body']; |
| 145 | 145 | $endpoint = new Set(); |
| 146 | 146 | $endpoint->setBody($body); |
| 147 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 147 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 148 | 148 | return $response->getResponse(); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -152,40 +152,40 @@ discard block |
||
| 152 | 152 | * @param $params |
| 153 | 153 | * @return mixed |
| 154 | 154 | */ |
| 155 | - public function status($params=[]) |
|
| 155 | + public function status($params = []) |
|
| 156 | 156 | { |
| 157 | 157 | $body = $params['body']??[]; |
| 158 | 158 | $endpoint = new Status(); |
| 159 | 159 | $endpoint->setBody($body); |
| 160 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 160 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 161 | 161 | return $response->getResponse(); |
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function tables($params=[]) |
|
| 165 | + public function tables($params = []) |
|
| 166 | 166 | { |
| 167 | 167 | $body = $params['body']??[]; |
| 168 | 168 | $endpoint = new Tables(); |
| 169 | 169 | $endpoint->setBody($body); |
| 170 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 170 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 171 | 171 | return $response->getResponse(); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function threads($params=[]) |
|
| 174 | + public function threads($params = []) |
|
| 175 | 175 | { |
| 176 | 176 | $body = $params['body']??[]; |
| 177 | 177 | $endpoint = new Threads(); |
| 178 | 178 | $endpoint->setBody($body); |
| 179 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 179 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 180 | 180 | return $response->getResponse(); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - public function variables($params=[]) |
|
| 183 | + public function variables($params = []) |
|
| 184 | 184 | { |
| 185 | 185 | $body = $params['body']??[]; |
| 186 | 186 | $endpoint = new Variables(); |
| 187 | 187 | $endpoint->setBody($body); |
| 188 | - $response = $this->_client->request($endpoint,$this->_params); |
|
| 188 | + $response = $this->_client->request($endpoint, $this->_params); |
|
| 189 | 189 | return $response->getResponse(); |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * @param string $message |
| 24 | 24 | * @param Request|null $request |
| 25 | 25 | */ |
| 26 | - public function __construct($message = '', Request $request=null) |
|
| 26 | + public function __construct($message = '', Request $request = null) |
|
| 27 | 27 | { |
| 28 | 28 | $this->_request = $request; |
| 29 | 29 | parent::__construct($message); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | foreach($response['data'] as $property) { |
| 20 | 20 | if(count($response['columns'])>2) { |
| 21 | 21 | $data[array_shift($property)] = $property; |
| 22 | - }else{ |
|
| 22 | + } else{ |
|
| 23 | 23 | $data[$property[$response['columns'][0]]] = $property[$response['columns'][1]]; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $response = parent::getResponse(); |
| 14 | 14 | |
| 15 | - if(isset($response['columns'], $response['data'])) |
|
| 15 | + if (isset($response['columns'], $response['data'])) |
|
| 16 | 16 | { |
| 17 | - $data=[]; |
|
| 18 | - $names = array_walk($response['columns'], static function(&$value, $key) {$value= array_keys($value)[0];}); |
|
| 19 | - foreach($response['data'] as $property) { |
|
| 20 | - if(count($response['columns'])>2) { |
|
| 17 | + $data = []; |
|
| 18 | + $names = array_walk($response['columns'], static function(&$value, $key) {$value = array_keys($value)[0]; }); |
|
| 19 | + foreach ($response['data'] as $property) { |
|
| 20 | + if (count($response['columns']) > 2) { |
|
| 21 | 21 | $data[array_shift($property)] = $property; |
| 22 | - }else{ |
|
| 22 | + } else { |
|
| 23 | 23 | $data[$property[$response['columns'][0]]] = $property[$response['columns'][1]]; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -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,8 +52,8 @@ discard block |
||
| 52 | 52 | public function getConnection(): Connection |
| 53 | 53 | { |
| 54 | 54 | $this->retries_attempts++; |
| 55 | - $connection = $this->strategy->getConnection($this->_connections); |
|
| 56 | - if($connection->isAlive()) { |
|
| 55 | + $connection = $this->strategy->getConnection($this->_connections); |
|
| 56 | + if ($connection->isAlive()) { |
|
| 57 | 57 | return $connection; |
| 58 | 58 | } |
| 59 | 59 | if ($this->retries_attempts < $this->retries) { |