@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function setBody($params = null) |
| 15 | 15 | { |
| 16 | 16 | if (isset($this->_index)) { |
| 17 | - $binds =[]; |
|
| 17 | + $binds = []; |
|
| 18 | 18 | $binds[] = "'" . Utils::escape($params['query']) . "'"; |
| 19 | 19 | $binds[] = "'" . $this->_index . "'"; |
| 20 | 20 | if (count($params['options']) > 0) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $binds[] = "$value AS $name"; |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - return parent::setBody( ['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
| 25 | + return parent::setBody(['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
| 26 | 26 | } |
| 27 | 27 | throw new RuntimeException('Index name is missing.'); |
| 28 | 28 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | if (isset($this->_index)) { |
| 23 | - return parent::setBody(['query' => "FLUSH RAMCHUNK ".$this->_index]); |
|
| 23 | + return parent::setBody(['query' => "FLUSH RAMCHUNK " . $this->_index]); |
|
| 24 | 24 | } |
| 25 | 25 | throw new RuntimeException('Index name is missing.'); |
| 26 | 26 | } |
@@ -104,21 +104,21 @@ |
||
| 104 | 104 | return $this; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function highlight($fields = [],$settings=[]): self |
|
| 107 | + public function highlight($fields = [], $settings = []): self |
|
| 108 | 108 | { |
| 109 | 109 | |
| 110 | - if (count($fields) === 0 && count($settings)===0) { |
|
| 111 | - $this->_params['highlight'] = new \stdClass(); |
|
| 110 | + if (count($fields) === 0 && count($settings) === 0) { |
|
| 111 | + $this->_params['highlight'] = new \stdClass(); |
|
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | $this->_params['highlight'] = []; |
| 115 | 115 | if (count($fields) > 0) { |
| 116 | - $this->_params['highlight']['fields'] =$fields; |
|
| 116 | + $this->_params['highlight']['fields'] = $fields; |
|
| 117 | 117 | } |
| 118 | - if(count($settings)>0) { |
|
| 119 | - foreach($settings as $name=>$value) |
|
| 118 | + if (count($settings) > 0) { |
|
| 119 | + foreach ($settings as $name=>$value) |
|
| 120 | 120 | { |
| 121 | - $this->_params['highlight'][$name] =$value; |
|
| 121 | + $this->_params['highlight'][$name] = $value; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | return $this; |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Range extends Query |
| 9 | 9 | { |
| 10 | - public function __construct($field, $args=[]) |
|
| 10 | + public function __construct($field, $args = []) |
|
| 11 | 11 | { |
| 12 | 12 | $this->_params['range'] = [$field => $args]; |
| 13 | 13 | } |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function __construct($keywords, $fields) |
| 11 | 11 | { |
| 12 | - $this->_params['match'] =[$fields => $keywords]; |
|
| 12 | + $this->_params['match'] = [$fields => $keywords]; |
|
| 13 | 13 | } |
| 14 | 14 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function __construct($client) |
| 25 | 25 | { |
| 26 | 26 | $this->_client = $client; |
| 27 | - $this->_params =['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 27 | + $this->_params = ['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function alter($params) |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function getTransportHandler(LoggerInterface $logger) |
| 174 | 174 | { |
| 175 | - return Transport::create($this->getTransport(), $this,$logger); |
|
| 175 | + return Transport::create($this->getTransport(), $this, $logger); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | * @return mixed|null |
| 193 | 193 | * |
| 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; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $_response; |
| 46 | 46 | |
| 47 | - public function __construct( $responseString, $status = null) |
|
| 47 | + public function __construct($responseString, $status = null) |
|
| 48 | 48 | { |
| 49 | 49 | if (is_array($responseString)) { |
| 50 | 50 | $this->_response = $responseString; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function hasError() |
| 81 | 81 | { |
| 82 | 82 | $response = $this->getResponse(); |
| 83 | - return (isset($response['error']) && $response['error'] !== '') || (isset($response['errors']) && $response['errors'] !== false); |
|
| 83 | + return (isset($response['error']) && $response['error'] !== '') || (isset($response['errors']) && $response['errors'] !== false); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /* |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $response = $this->getResponse(); |
| 93 | 93 | if (isset($response['error'])) { |
| 94 | 94 | return json_encode($response['error'], true); |
| 95 | - } elseif (isset($response['errors'])){ |
|
| 95 | + } elseif (isset($response['errors'])) { |
|
| 96 | 96 | return json_encode($response['errors'], true); |
| 97 | 97 | } else { |
| 98 | 98 | return ''; |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $this->_logger->info( |
| 88 | 88 | 'Request:', |
| 89 | 89 | [ |
| 90 | - 'url' => $url, |
|
| 90 | + 'url' => $url, |
|
| 91 | 91 | 'status' => $status, |
| 92 | 92 | 'time' => $time |
| 93 | 93 | ] |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * @return Response |
| 42 | 42 | * @throws \Http\Client\Exception |
| 43 | 43 | */ |
| 44 | - public function execute(Request $request, $params=[]) |
|
| 44 | + public function execute(Request $request, $params = []) |
|
| 45 | 45 | { |
| 46 | 46 | $connection = $this->getConnection(); |
| 47 | 47 | |