@@ -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; |
@@ -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) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function getTransportHandler(LoggerInterface $logger) |
| 175 | 175 | { |
| 176 | - return Transport::create($this->getTransport(), $this,$logger); |
|
| 176 | + return Transport::create($this->getTransport(), $this, $logger); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | * @param string|null |
| 193 | 193 | * @return mixed|null |
| 194 | 194 | */ |
| 195 | - public function getConfig($key = null) |
|
| 195 | + public function getConfig($key = null) |
|
| 196 | 196 | { |
| 197 | - if($key === null) { |
|
| 197 | + if ($key === null) { |
|
| 198 | 198 | return $this->config; |
| 199 | 199 | } |
| 200 | 200 | return $this->config[$key] ?? null; |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function setBody($params = null) |
| 17 | 17 | { |
| 18 | - if(isset($params['name'], $params['type']) && $params['library']) { |
|
| 19 | - return parent::setBody(['query' => "CREATE PLUGIN " . $params['name']." TYPE ".strtoupper($params['type']). " SONAME ".$params['library']]); |
|
| 18 | + if (isset($params['name'], $params['type']) && $params['library']) { |
|
| 19 | + return parent::setBody(['query' => "CREATE PLUGIN " . $params['name'] . " TYPE " . strtoupper($params['type']) . " SONAME " . $params['library']]); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | throw new RuntimeException('Incomplete request for /nodes/createplugin'); |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | protected $_index; |
| 15 | 15 | |
| 16 | - public function setBody( $params = null) |
|
| 16 | + public function setBody($params = null) |
|
| 17 | 17 | { |
| 18 | - if(isset( $this->_index)) { |
|
| 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,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.'); |