Passed
Pull Request — v3 (#709)
by
unknown
34:20
created
src/GameQ/Protocols/Scum.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
         $buffer_search = implode(array_map(function ($val) {
144 144
             return pack("C", $val);
145
-        }, array_reverse(explode(".", $this->realIp)))).pack("S", ($this->realPortQuery + 2));
145
+        }, array_reverse(explode(".", $this->realIp)))) . pack("S", ($this->realPortQuery + 2));
146 146
 
147 147
         // No response, assume offline
148 148
         if (empty($this->packets_response)) {
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
             ];
155 155
         }
156 156
 
157
-        $buffer = new Buffer( implode('', $this->packets_response) );
157
+        $buffer = new Buffer(implode('', $this->packets_response));
158 158
 
159
-        if (str_contains( $buffer->getData() , $buffer_search )) {
159
+        if (str_contains($buffer->getData(), $buffer_search)) {
160 160
 
161 161
             $buffer->readString($buffer_search);
162 162
             $buffer->skip(5);
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
             $result->add('gq_port_query', ($this->realPortQuery + 2));
173 173
 
174 174
             // Add server items
175
-            $result->add('hostname', $buffer->read(101) );
176
-            $result->add('numplayers', $buffer->readInt8(2) );
177
-            $result->add('maxplayers', $buffer->readInt8(2) );
175
+            $result->add('hostname', $buffer->read(101));
176
+            $result->add('numplayers', $buffer->readInt8(2));
177
+            $result->add('maxplayers', $buffer->readInt8(2));
178 178
 
179 179
             //Get From 109 until 110
180
-            $time = base_convert(bin2hex( $buffer->read(1) ), 16, 10);
180
+            $time = base_convert(bin2hex($buffer->read(1)), 16, 10);
181 181
             $result->add('time', (strlen($time) != 1 ? $time : '0' . $time) . ':00');
182 182
 
183 183
             //Get From 111 until 112
184 184
             $buffer->skip(1);
185
-            $pwd_bin = ( base_convert(bin2hex($buffer->read(1)), 16, 2 ));
186
-            if(strlen($pwd_bin) >= 2){
187
-                $result->add('password', ($pwd_bin[-2] == '1' ? 1 : 0) );
185
+            $pwd_bin = (base_convert(bin2hex($buffer->read(1)), 16, 2));
186
+            if (strlen($pwd_bin) >= 2) {
187
+                $result->add('password', ($pwd_bin[-2] == '1' ? 1 : 0));
188 188
             }
189 189
 
190 190
             //Get From 120 until 126
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             $byte2 = hexdec(bin2hex($buffer->read(1)));
199 199
             $byte1 = hexdec(bin2hex($buffer->read(1)));
200 200
 
201
-            $result->add('version', $byte1 . "." . $byte2 . "." . hexdec( $byte3 . $byte4 ) . "." . hexdec( $byte5.$byte6.$byte7.$byte8 ));
201
+            $result->add('version', $byte1 . "." . $byte2 . "." . hexdec($byte3 . $byte4) . "." . hexdec($byte5 . $byte6 . $byte7 . $byte8));
202 202
 
203 203
             unset($buffer);
204 204
 
Please login to merge, or discard this patch.