Passed
Push — master ( e929c7...a0937b )
by
unknown
01:56
created
src/Manticoresearch/Index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function addDocument($data, $id = 0)
54 54
     {
55 55
         if (is_object($data)) {
56
-            $data = (array) $data;
56
+            $data = (array)$data;
57 57
         } elseif (is_string($data)) {
58 58
             $data = json_decode($data, true);
59 59
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $toinsert = [];
77 77
         foreach ($documents as $document) {
78 78
             if (is_object($document)) {
79
-                $document = (array) $document;
79
+                $document = (array)$document;
80 80
             } elseif (is_string($document)) {
81 81
                 $document = json_decode($document, true);
82 82
             }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     public function replaceDocument($data, $id)
167 167
     {
168 168
         if (is_object($data)) {
169
-            $data = (array) $data;
169
+            $data = (array)$data;
170 170
         } elseif (is_string($data)) {
171 171
             $data = json_decode($data, true);
172 172
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $toreplace = [];
189 189
         foreach ($documents as $document) {
190 190
             if (is_object($document)) {
191
-                $document = (array) $document;
191
+                $document = (array)$document;
192 192
             } elseif (is_string($document)) {
193 193
                 $document = json_decode($document, true);
194 194
             }
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
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
     public function highlight($fields = [], $settings = []): self
110 110
     {
111 111
 
112
-        if (count($fields) === 0 && count($settings)===0) {
113
-            $this->params['highlight'] =  new \stdClass();
112
+        if (count($fields) === 0 && count($settings) === 0) {
113
+            $this->params['highlight'] = new \stdClass();
114 114
             return $this;
115 115
         }
116 116
         $this->params['highlight'] = [];
117 117
         if (count($fields) > 0) {
118
-            $this->params['highlight']['fields'] =$fields;
118
+            $this->params['highlight']['fields'] = $fields;
119 119
         }
120
-        if (count($settings)>0) {
120
+        if (count($settings) > 0) {
121 121
             foreach ($settings as $name => $value) {
122
-                $this->params['highlight'][$name] =$value;
122
+                $this->params['highlight'][$name] = $value;
123 123
             }
124 124
         }
125 125
         return $this;
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
             $group = $field;
258 258
         }
259 259
         $terms = ['field'=>$field];
260
-        if ($limit !==null) {
260
+        if ($limit !== null) {
261 261
             $terms['size'] = $limit;
262 262
         }
263
-        $this->params['aggs'][$group] =['terms' =>$terms];
263
+        $this->params['aggs'][$group] = ['terms' =>$terms];
264 264
         return $this;
265 265
     }
266 266
 
Please login to merge, or discard this patch.
src/Manticoresearch/Endpoints/Indices/Create.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@
 block discarded – undo
34 34
             $options = "";
35 35
             if (isset($params['settings'])) {
36 36
                 foreach ($params['settings'] as $name => $value) {
37
-                    $options.=" ".$name." = '".$value."'";
37
+                    $options .= " " . $name . " = '" . $value . "'";
38 38
                     if (is_array($value)) {
39 39
                         foreach ($value as $v) {
40
-                            $options.=" ".$name." = '".$v."'";
40
+                            $options .= " " . $name . " = '" . $v . "'";
41 41
                         }
42 42
                     } else {
43
-                        $options.=" ".$name." = '".$value."'";
43
+                        $options .= " " . $name . " = '" . $value . "'";
44 44
                     }
45 45
                 }
46 46
             }
47
-            return parent::setBody(['query' => "CREATE TABLE ".
48
-                (isset($params['silent']) && $params['silent']===true?' IF NOT EXISTS ':'').
49
-                $this->index.
50
-                (count($columns)>0?"(".implode(",", $columns).")":" ")
47
+            return parent::setBody(['query' => "CREATE TABLE " .
48
+                (isset($params['silent']) && $params['silent'] === true ? ' IF NOT EXISTS ' : '') .
49
+                $this->index .
50
+                (count($columns) > 0 ? "(" . implode(",", $columns) . ")" : " ")
51 51
                 .$options]);
52 52
         }
53 53
         throw new RuntimeException('Index name is missing.');
Please login to merge, or discard this patch.
src/Manticoresearch/Query/MatchQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
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
 }
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, []);
@@ -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/Transport/Http.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $connection = $this->getConnection();
32 32
         $conn = $this->getCurlConnection($connection->getConfig('persistent'));
33
-        $url = $this->scheme.'://'.$connection->getHost().':'.$connection->getPort();
33
+        $url = $this->scheme . '://' . $connection->getHost() . ':' . $connection->getPort();
34 34
         $endpoint = $request->getPath();
35 35
         $url .= $endpoint;
36 36
         $url = $this->setupURI($url, $request->getQuery());
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         curl_setopt($conn, CURLOPT_CUSTOMREQUEST, $method);
57 57
         curl_setopt($conn, CURLOPT_HTTPHEADER, $headers);
58 58
 
59
-        if ($connection->getConnectTimeout()>0) {
59
+        if ($connection->getConnectTimeout() > 0) {
60 60
             curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, $connection->getConnectTimeout());
61 61
         }
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             curl_setopt(
66 66
                 $conn,
67 67
                 CURLOPT_USERPWD,
68
-                $connection->getConfig('username').":".$connection->getConfig('password')
68
+                $connection->getConfig('username') . ":" . $connection->getConfig('password')
69 69
             );
70 70
         }
71 71
         if ($connection->getConfig('proxy') !== null) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $status = curl_getinfo($conn, CURLINFO_HTTP_CODE);
86 86
         if (isset($params['responseClass'])) {
87 87
             $responseClass = $params['responseClass'];
88
-            $responseClassParams = isset($params['responseClassParams'])?$params['responseClassParams']:[];
88
+            $responseClassParams = isset($params['responseClassParams']) ? $params['responseClassParams'] : [];
89 89
             $response = new $responseClass($responseString, $status, $responseClassParams);
90 90
         } else {
91 91
             $response = new Response($responseString, $status);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 'body' => $request->getBody()
100 100
             ]);
101 101
         //hard error
102
-        if ($errorno>0) {
102
+        if ($errorno > 0) {
103 103
             $error = curl_error($conn);
104 104
 
105 105
             self::$curl = null;
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
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
         $response = parent::getResponse();
12 12
         if (isset($response['columns'], $response['data'])) {
13 13
             $data = [];
14
-            array_walk($response['columns'], static function (&$value, $key) {
14
+            array_walk($response['columns'], static function(&$value, $key) {
15 15
                 $value = array_keys($value)[0];
16 16
             });
17 17
             $id = -1;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 } else {
69 69
                     $id++;
70 70
                 }
71
-                $data[$id] = (count($property) == 1)?array_shift($property):$property;
71
+                $data[$id] = (count($property) == 1) ?array_shift($property) : $property;
72 72
             }
73 73
             if (count($data) > 0) {
74 74
                 return $data;
Please login to merge, or discard this patch.