@@ -159,13 +159,13 @@ |
||
159 | 159 | * @param bool $obj |
160 | 160 | * @return array|Response |
161 | 161 | */ |
162 | - public function search(array $params = [],$obj=false) |
|
162 | + public function search(array $params = [], $obj = false) |
|
163 | 163 | { |
164 | 164 | $endpoint = new Endpoints\Search($params); |
165 | 165 | $response = $this->request($endpoint); |
166 | - if($obj ===true) { |
|
166 | + if ($obj === true) { |
|
167 | 167 | return $response; |
168 | - }else{ |
|
168 | + } else { |
|
169 | 169 | return $response->getResponse(); |
170 | 170 | } |
171 | 171 | } |
@@ -165,7 +165,7 @@ |
||
165 | 165 | $response = $this->request($endpoint); |
166 | 166 | if($obj ===true) { |
167 | 167 | return $response; |
168 | - }else{ |
|
168 | + } else{ |
|
169 | 169 | return $response->getResponse(); |
170 | 170 | } |
171 | 171 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } elseif (is_array($v)) { |
26 | 26 | $return[$k] = $this->_toArray($v); |
27 | 27 | } else { |
28 | - if ($v!==null) { |
|
28 | + if ($v !== null) { |
|
29 | 29 | $return[$k] = $v; |
30 | 30 | } else { |
31 | 31 | return null; |
@@ -16,11 +16,11 @@ |
||
16 | 16 | { |
17 | 17 | $option = ""; |
18 | 18 | if (isset($params['pattern'])) { |
19 | - $option = "LIKE '".$params['pattern']."'"; |
|
19 | + $option = "LIKE '" . $params['pattern'] . "'"; |
|
20 | 20 | } |
21 | 21 | if (isset($params['where'])) { |
22 | - $option = "WHERE variable_name='".$params['where']['variable_name']."'"; |
|
22 | + $option = "WHERE variable_name='" . $params['where']['variable_name'] . "'"; |
|
23 | 23 | } |
24 | - return parent::setBody(['query' => "SHOW ".($params['type'] ?? '')." VARIABLES ".$option]); |
|
24 | + return parent::setBody(['query' => "SHOW " . ($params['type'] ?? '') . " VARIABLES " . $option]); |
|
25 | 25 | } |
26 | 26 | } |
@@ -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 | } |
@@ -30,9 +30,9 @@ |
||
30 | 30 | */ |
31 | 31 | protected $_content_type; |
32 | 32 | |
33 | - public function __construct($params=[]) |
|
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'); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | return $this->_client->bulk(['body' => $toreplace]); |
150 | 150 | } |
151 | 151 | |
152 | - public function create($fields, $settings = [],$silent=false) |
|
152 | + public function create($fields, $settings = [], $silent = false) |
|
153 | 153 | { |
154 | 154 | $params = [ |
155 | 155 | 'index' => $this->_index, |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | 'settings' => $settings |
159 | 159 | ] |
160 | 160 | ]; |
161 | - if($silent===true) { |
|
161 | + if ($silent === true) { |
|
162 | 162 | $params['body']['silent'] = true; |
163 | 163 | } |
164 | 164 | return $this->_client->indices()->create($params); |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | $this->_client->indices()->flushramchunk($params); |
227 | 227 | } |
228 | 228 | |
229 | - public function alter($operation,$name, $type) |
|
229 | + public function alter($operation, $name, $type) |
|
230 | 230 | { |
231 | - if($operation==='add') { |
|
231 | + if ($operation === 'add') { |
|
232 | 232 | $params = [ |
233 | 233 | 'index' => $this->_index, |
234 | 234 | 'body' => [ |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ] |
238 | 238 | ]; |
239 | 239 | |
240 | - }elseif($operation==='drop'){ |
|
240 | + }elseif ($operation === 'drop') { |
|
241 | 241 | $params = [ |
242 | 242 | 'index' => $this->_index, |
243 | 243 | 'body' => [ |
@@ -237,7 +237,7 @@ |
||
237 | 237 | ] |
238 | 238 | ]; |
239 | 239 | |
240 | - }elseif($operation==='drop'){ |
|
240 | + } elseif($operation==='drop'){ |
|
241 | 241 | $params = [ |
242 | 242 | 'index' => $this->_index, |
243 | 243 | 'body' => [ |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | if (isset($response['columns'], $response['data'])) { |
15 | 15 | $data=[]; |
16 | - array_walk($response['columns'], static function (&$value, $key) { |
|
16 | + array_walk($response['columns'], static function (&$value, $key) { |
|
17 | 17 | $value= array_keys($value)[0]; |
18 | 18 | }); |
19 | 19 | foreach ($response['data'] as $property) { |
@@ -12,12 +12,12 @@ |
||
12 | 12 | $response = parent::getResponse(); |
13 | 13 | |
14 | 14 | if (isset($response['columns'], $response['data'])) { |
15 | - $data=[]; |
|
16 | - array_walk($response['columns'], static function (&$value, $key) { |
|
17 | - $value= array_keys($value)[0]; |
|
15 | + $data = []; |
|
16 | + array_walk($response['columns'], static function(&$value, $key) { |
|
17 | + $value = array_keys($value)[0]; |
|
18 | 18 | }); |
19 | 19 | foreach ($response['data'] as $property) { |
20 | - if (count($response['columns'])>2) { |
|
20 | + if (count($response['columns']) > 2) { |
|
21 | 21 | $data[array_shift($property)] = $property; |
22 | 22 | } else { |
23 | 23 | $data[$property[$response['columns'][0]]] = $property[$response['columns'][1]]; |
@@ -18,8 +18,8 @@ |
||
18 | 18 | $this->_body = $params; |
19 | 19 | if (isset($params['variable']) && is_array($params['variable'])) { |
20 | 20 | return parent::setBody([ |
21 | - 'query' => "SET " . (isset($params['type']) ? $params['type'] . "'" : "")." ". |
|
22 | - $params['variable']['name']."=" . $params['variable']['value'] |
|
21 | + 'query' => "SET " . (isset($params['type']) ? $params['type'] . "'" : "") . " " . |
|
22 | + $params['variable']['name'] . "=" . $params['variable']['value'] |
|
23 | 23 | ]); |
24 | 24 | |
25 | 25 | } |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | public function __construct($client) |
39 | 39 | { |
40 | 40 | $this->_client = $client; |
41 | - $this->_params =['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
41 | + $this->_params = ['responseClass'=>'Manticoresearch\\Response\\SqlToArray']; |
|
42 | 42 | } |
43 | 43 | |
44 | - public function agentstatus($params=[]) |
|
44 | + public function agentstatus($params = []) |
|
45 | 45 | { |
46 | 46 | $body = $params['body']??[]; |
47 | 47 | $endpoint = new AgentStatus(); |
48 | 48 | $endpoint->setBody($body); |
49 | - $response = $this->_client->request($endpoint,$this->_params); |
|
49 | + $response = $this->_client->request($endpoint, $this->_params); |
|
50 | 50 | return $response->getResponse(); |
51 | 51 | } |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $body = $params['body']; |
56 | 56 | $endpoint = new CreateFunction(); |
57 | 57 | $endpoint->setBody($body); |
58 | - $response = $this->_client->request($endpoint,$this->_params); |
|
58 | + $response = $this->_client->request($endpoint, $this->_params); |
|
59 | 59 | return $response->getResponse(); |
60 | 60 | } |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $body = $params['body']; |
65 | 65 | $endpoint = new CreatePlugin(); |
66 | 66 | $endpoint->setBody($body); |
67 | - $response = $this->_client->request($endpoint,$this->_params); |
|
67 | + $response = $this->_client->request($endpoint, $this->_params); |
|
68 | 68 | return $response->getResponse(); |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $body = $params['body']; |
74 | 74 | $endpoint = new Debug(); |
75 | 75 | $endpoint->setBody($body); |
76 | - $response = $this->_client->request($endpoint,$this->_params); |
|
76 | + $response = $this->_client->request($endpoint, $this->_params); |
|
77 | 77 | return $response->getResponse(); |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $body = $params['body']; |
83 | 83 | $endpoint = new DropFunction(); |
84 | 84 | $endpoint->setBody($body); |
85 | - $response = $this->_client->request($endpoint,$this->_params); |
|
85 | + $response = $this->_client->request($endpoint, $this->_params); |
|
86 | 86 | return $response->getResponse(); |
87 | 87 | } |
88 | 88 | |
@@ -91,61 +91,61 @@ discard block |
||
91 | 91 | $body = $params['body']; |
92 | 92 | $endpoint = new DropPlugin(); |
93 | 93 | $endpoint->setBody($body); |
94 | - $response = $this->_client->request($endpoint,$this->_params); |
|
94 | + $response = $this->_client->request($endpoint, $this->_params); |
|
95 | 95 | return $response->getResponse(); |
96 | 96 | } |
97 | 97 | |
98 | - public function flushattributes($params=[]) |
|
98 | + public function flushattributes($params = []) |
|
99 | 99 | { |
100 | 100 | $body = $params['body']??[]; |
101 | 101 | $endpoint = new FlushAttributes(); |
102 | 102 | $endpoint->setBody($body); |
103 | - $response = $this->_client->request($endpoint,$this->_params); |
|
103 | + $response = $this->_client->request($endpoint, $this->_params); |
|
104 | 104 | return $response->getResponse(); |
105 | 105 | } |
106 | 106 | |
107 | - public function flushhostnames($params=[]) |
|
107 | + public function flushhostnames($params = []) |
|
108 | 108 | { |
109 | 109 | $body = $params['body']??[]; |
110 | 110 | $endpoint = new FlushHostnames(); |
111 | 111 | $endpoint->setBody($body); |
112 | - $response = $this->_client->request($endpoint,$this->_params); |
|
112 | + $response = $this->_client->request($endpoint, $this->_params); |
|
113 | 113 | return $response->getResponse(); |
114 | 114 | } |
115 | 115 | |
116 | - public function flushlogs($params=[]) |
|
116 | + public function flushlogs($params = []) |
|
117 | 117 | { |
118 | 118 | $body = $params['body']??[]; |
119 | 119 | $endpoint = new FlushLogs(); |
120 | 120 | $endpoint->setBody($body); |
121 | - $response = $this->_client->request($endpoint,$this->_params); |
|
121 | + $response = $this->_client->request($endpoint, $this->_params); |
|
122 | 122 | return $response->getResponse(); |
123 | 123 | } |
124 | 124 | |
125 | - public function plugins($params=[]) |
|
125 | + public function plugins($params = []) |
|
126 | 126 | { |
127 | 127 | $body = $params['body']??[]; |
128 | 128 | $endpoint = new Plugins(); |
129 | 129 | $endpoint->setBody($body); |
130 | - $response = $this->_client->request($endpoint,$this->_params); |
|
130 | + $response = $this->_client->request($endpoint, $this->_params); |
|
131 | 131 | return $response->getResponse(); |
132 | 132 | } |
133 | 133 | |
134 | - public function reloadindexes($params=[]) |
|
134 | + public function reloadindexes($params = []) |
|
135 | 135 | { |
136 | 136 | $body = $params['body']??[]; |
137 | 137 | $endpoint = new ReloadIndexes(); |
138 | 138 | $endpoint->setBody($body); |
139 | - $response = $this->_client->request($endpoint,$this->_params); |
|
139 | + $response = $this->_client->request($endpoint, $this->_params); |
|
140 | 140 | return $response->getResponse(); |
141 | 141 | } |
142 | 142 | |
143 | - public function reloadplugins($params=[]) |
|
143 | + public function reloadplugins($params = []) |
|
144 | 144 | { |
145 | 145 | $body = $params['body']??[]; |
146 | 146 | $endpoint = new ReloadPlugins(); |
147 | 147 | $endpoint->setBody($body); |
148 | - $response = $this->_client->request($endpoint,$this->_params); |
|
148 | + $response = $this->_client->request($endpoint, $this->_params); |
|
149 | 149 | return $response->getResponse(); |
150 | 150 | } |
151 | 151 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $body = $params['body']; |
155 | 155 | $endpoint = new Set(); |
156 | 156 | $endpoint->setBody($body); |
157 | - $response = $this->_client->request($endpoint,$this->_params); |
|
157 | + $response = $this->_client->request($endpoint, $this->_params); |
|
158 | 158 | return $response->getResponse(); |
159 | 159 | } |
160 | 160 | |
@@ -162,40 +162,40 @@ discard block |
||
162 | 162 | * @param array $params |
163 | 163 | * @return mixed |
164 | 164 | */ |
165 | - public function status($params=[]) |
|
165 | + public function status($params = []) |
|
166 | 166 | { |
167 | 167 | $body = $params['body']??[]; |
168 | 168 | $endpoint = new Status(); |
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 | 174 | |
175 | - public function tables($params=[]) |
|
175 | + public function tables($params = []) |
|
176 | 176 | { |
177 | 177 | $body = $params['body']??[]; |
178 | 178 | $endpoint = new Tables(); |
179 | 179 | $endpoint->setBody($body); |
180 | - $response = $this->_client->request($endpoint,$this->_params); |
|
180 | + $response = $this->_client->request($endpoint, $this->_params); |
|
181 | 181 | return $response->getResponse(); |
182 | 182 | } |
183 | 183 | |
184 | - public function threads($params=[]) |
|
184 | + public function threads($params = []) |
|
185 | 185 | { |
186 | 186 | $body = $params['body']??[]; |
187 | 187 | $endpoint = new Threads(); |
188 | 188 | $endpoint->setBody($body); |
189 | - $response = $this->_client->request($endpoint,$this->_params); |
|
189 | + $response = $this->_client->request($endpoint, $this->_params); |
|
190 | 190 | return $response->getResponse(); |
191 | 191 | } |
192 | 192 | |
193 | - public function variables($params=[]) |
|
193 | + public function variables($params = []) |
|
194 | 194 | { |
195 | 195 | $body = $params['body']??[]; |
196 | 196 | $endpoint = new Variables(); |
197 | 197 | $endpoint->setBody($body); |
198 | - $response = $this->_client->request($endpoint,$this->_params); |
|
198 | + $response = $this->_client->request($endpoint, $this->_params); |
|
199 | 199 | return $response->getResponse(); |
200 | 200 | } |
201 | 201 | } |