Passed
Push — master ( 0099d1...603048 )
by
unknown
04:49
created
src/Manticoresearch/Transport/PhpHttp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 
78 78
         if (isset($params['responseClass'])) {
79 79
             $responseClass = $params['responseClass'];
80
-            $responseClassParams = isset($params['responseClassParams'])?$params['responseClassParams']:[];
80
+            $responseClassParams = isset($params['responseClassParams']) ? $params['responseClassParams'] : [];
81 81
             $response = new $responseClass($responseString, $status, $responseClassParams);
82 82
         } else {
83 83
             $response = new Response($responseString, $status);
Please login to merge, or discard this patch.
src/Manticoresearch/Utils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
 {
8 8
     public static function escape($string): string
9 9
     {
10
-        $from = ['\\', '(',')','|','-','!','@','~','"','&', '/', '^', '$', '=', '<'];
11
-        $to = ['\\\\', '\(','\)','\|','\-','\!','\@','\~','\"', '\&', '\/', '\^', '\$', '\=', '\<'];
10
+        $from = ['\\', '(', ')', '|', '-', '!', '@', '~', '"', '&', '/', '^', '$', '=', '<'];
11
+        $to = ['\\\\', '\(', '\)', '\|', '\-', '\!', '\@', '\~', '\"', '\&', '\/', '\^', '\$', '\=', '\<'];
12 12
         return str_replace($from, $to, $string);
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Manticoresearch/Endpoints/Sql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         if ($this->mode === 'raw') {
37 37
             $return = ['mode=raw'];
38 38
             foreach ($this->body as $k => $v) {
39
-                $return[]= $k.'='.urlencode($v);
39
+                $return[] = $k . '=' . urlencode($v);
40 40
             }
41 41
             return implode('&', $return);
42 42
         } else {
Please login to merge, or discard this patch.
src/Manticoresearch/Nodes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
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(
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function flushattributes($params = [])
104 104
     {
105
-        $body = $params['body']??[];
105
+        $body = $params['body'] ?? [];
106 106
         $endpoint = new FlushAttributes();
107 107
         $endpoint->setBody($body);
108 108
         $response = $this->client->request($endpoint, ['responseClass'=>'Manticoresearch\\Response\\Sql']);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
     public function flushhostnames($params = [])
113 113
     {
114
-        $body = $params['body']??[];
114
+        $body = $params['body'] ?? [];
115 115
         $endpoint = new FlushHostnames();
116 116
         $endpoint->setBody($body);
117 117
         $response = $this->client->request($endpoint, $this->params);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     public function flushlogs($params = [])
122 122
     {
123
-        $body = $params['body']??[];
123
+        $body = $params['body'] ?? [];
124 124
         $endpoint = new FlushLogs();
125 125
         $endpoint->setBody($body);
126 126
         $response = $this->client->request($endpoint, $this->params);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     public function plugins($params = [])
131 131
     {
132
-        $body = $params['body']??[];
132
+        $body = $params['body'] ?? [];
133 133
         $endpoint = new Plugins();
134 134
         $endpoint->setBody($body);
135 135
         $response = $this->client->request($endpoint, $this->params);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
     public function reloadindexes($params = [])
140 140
     {
141
-        $body = $params['body']??[];
141
+        $body = $params['body'] ?? [];
142 142
         $endpoint = new ReloadIndexes();
143 143
         $endpoint->setBody($body);
144 144
         $response = $this->client->request($endpoint, $this->params);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
     public function reloadplugins($params = [])
149 149
     {
150
-        $body = $params['body']??[];
150
+        $body = $params['body'] ?? [];
151 151
         $endpoint = new ReloadPlugins();
152 152
         $endpoint->setBody($body);
153 153
         $response = $this->client->request($endpoint, $this->params);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function status($params = [])
171 171
     {
172
-        $body = $params['body']??[];
172
+        $body = $params['body'] ?? [];
173 173
         $endpoint = new Status();
174 174
         $endpoint->setBody($body);
175 175
         $response = $this->client->request(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     public function tables($params = [])
183 183
     {
184
-        $body = $params['body']??[];
184
+        $body = $params['body'] ?? [];
185 185
         $endpoint = new Tables();
186 186
         $endpoint->setBody($body);
187 187
         $response = $this->client->request(
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     public function threads($params = [])
195 195
     {
196
-        $body = $params['body']??[];
196
+        $body = $params['body'] ?? [];
197 197
         $endpoint = new Threads();
198 198
         $endpoint->setBody($body);
199 199
         $response = $this->client->request($endpoint, $this->params);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     public function variables($params = [])
204 204
     {
205
-        $body = $params['body']??[];
205
+        $body = $params['body'] ?? [];
206 206
         $endpoint = new Variables();
207 207
         $endpoint->setBody($body);
208 208
         $response = $this->client->request(
Please login to merge, or discard this patch.
src/Manticoresearch/Response/SqlToArray.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
         if (isset($response['columns'], $response['data'])) {
24 24
             $data = [];
25
-            array_walk($response['columns'], static function (&$value, $key) {
25
+            array_walk($response['columns'], static function(&$value, $key) {
26 26
                 $value = array_keys($value)[0];
27 27
             });
28 28
             $id = -1;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 } else {
80 80
                     $id++;
81 81
                 }
82
-                $data[$id] = (count($property) == 1)?array_shift($property):$property;
82
+                $data[$id] = (count($property) == 1) ?array_shift($property) : $property;
83 83
             }
84 84
             return (count($data) > 0) ? $data : [];
85 85
         }
Please login to merge, or discard this patch.
src/Manticoresearch/Endpoints/Indices/Create.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@
 block discarded – undo
36 36
                 foreach ($params['settings'] as $name => $value) {
37 37
                     if (is_array($value)) {
38 38
                         foreach ($value as $v) {
39
-                            $options.=" ".$name." = '".$v."'";
39
+                            $options .= " " . $name . " = '" . $v . "'";
40 40
                         }
41 41
                     } else {
42
-                        $options.=" ".$name." = '".$value."'";
42
+                        $options .= " " . $name . " = '" . $value . "'";
43 43
                     }
44 44
                 }
45 45
             }
46
-            return parent::setBody(['query' => "CREATE TABLE ".
47
-                (isset($params['silent']) && $params['silent']===true?' IF NOT EXISTS ':'').
48
-                $this->index.
49
-                (count($columns)>0?"(".implode(",", $columns).")":" ")
46
+            return parent::setBody(['query' => "CREATE TABLE " .
47
+                (isset($params['silent']) && $params['silent'] === true ? ' IF NOT EXISTS ' : '') .
48
+                $this->index .
49
+                (count($columns) > 0 ? "(" . implode(",", $columns) . ")" : " ")
50 50
                 .$options]);
51 51
         }
52 52
         throw new RuntimeException('Index name is missing.');
Please login to merge, or discard this patch.
src/Manticoresearch/Index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         self::checkDocumentId($id);
74 74
         if (is_object($data)) {
75
-            $data = (array) $data;
75
+            $data = (array)$data;
76 76
         } elseif (is_string($data)) {
77 77
             $data = json_decode($data, true);
78 78
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $toinsert = [];
96 96
         foreach ($documents as $document) {
97 97
             if (is_object($document)) {
98
-                $document = (array) $document;
98
+                $document = (array)$document;
99 99
             } elseif (is_string($document)) {
100 100
                 $document = json_decode($document, true);
101 101
             }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         self::checkDocumentId($id);
191 191
         if (is_object($data)) {
192
-            $data = (array) $data;
192
+            $data = (array)$data;
193 193
         } elseif (is_string($data)) {
194 194
             $data = json_decode($data, true);
195 195
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $toreplace = [];
212 212
         foreach ($documents as $document) {
213 213
             if (is_object($document)) {
214
-                $document = (array) $document;
214
+                $document = (array)$document;
215 215
             } elseif (is_string($document)) {
216 216
                 $document = json_decode($document, true);
217 217
             }
Please login to merge, or discard this patch.
src/Manticoresearch/Search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
     public function highlight($fields = [], $settings = []): self
144 144
     {
145 145
 
146
-        if (count($fields) === 0 && count($settings)===0) {
147
-            $this->params['highlight'] =  new \stdClass();
146
+        if (count($fields) === 0 && count($settings) === 0) {
147
+            $this->params['highlight'] = new \stdClass();
148 148
             return $this;
149 149
         }
150 150
         $this->params['highlight'] = [];
151 151
         if (count($fields) > 0) {
152
-            $this->params['highlight']['fields'] =$fields;
152
+            $this->params['highlight']['fields'] = $fields;
153 153
         }
154
-        if (count($settings)>0) {
154
+        if (count($settings) > 0) {
155 155
             foreach ($settings as $name => $value) {
156
-                $this->params['highlight'][$name] =$value;
156
+                $this->params['highlight'][$name] = $value;
157 157
             }
158 158
         }
159 159
         return $this;
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             $group = $field;
261 261
         }
262 262
             $terms = ['field'=>$field];
263
-        if ($limit !==null) {
263
+        if ($limit !== null) {
264 264
             $terms['size'] = $limit;
265 265
         }
266 266
         $this->params['aggs'][$group] = ['terms' =>$terms];
267 267
         if ($sortField !== null) {
268
-            $this->params['aggs'][$group]['sort'] = [ [$sortField => $sortDirection] ];
268
+            $this->params['aggs'][$group]['sort'] = [[$sortField => $sortDirection]];
269 269
         }
270 270
         return $this;
271 271
     }
Please login to merge, or discard this patch.