@@ -18,7 +18,6 @@ |
||
18 | 18 | |
19 | 19 | namespace GameQ\Protocols; |
20 | 20 | |
21 | -use GameQ\Buffer; |
|
22 | 21 | use GameQ\Result; |
23 | 22 | |
24 | 23 | /** |
@@ -123,8 +123,8 @@ |
||
123 | 123 | /** |
124 | 124 | * Dirty hack to delete result items |
125 | 125 | * |
126 | - * @param array $result |
|
127 | - * @param array $array |
|
126 | + * @param array string[] |
|
127 | + * @param string[] $array |
|
128 | 128 | */ |
129 | 129 | protected function deleteResult(array &$result, array $array) |
130 | 130 | { |
@@ -33,14 +33,14 @@ |
||
33 | 33 | * |
34 | 34 | * @type array |
35 | 35 | */ |
36 | - protected $options = [ ]; |
|
36 | + protected $options = []; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Construct |
40 | 40 | * |
41 | 41 | * @param array $options |
42 | 42 | */ |
43 | - public function __construct($options = [ ]) |
|
43 | + public function __construct($options = []) |
|
44 | 44 | { |
45 | 45 | |
46 | 46 | $this->options = $options; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param \GameQ\Buffer $buffer |
149 | 149 | * @param \GameQ\Result $result |
150 | 150 | */ |
151 | - protected function processKeyValuePairs(Buffer &$buffer, Result &$result) |
|
151 | + protected function processKeyValuePairs(Buffer & $buffer, Result & $result) |
|
152 | 152 | { |
153 | 153 | |
154 | 154 | // Key / value pairs |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param \GameQ\Buffer $buffer |
177 | 177 | * @param \GameQ\Result $result |
178 | 178 | */ |
179 | - protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) |
|
179 | + protected function processPlayersAndTeams(Buffer & $buffer, Result & $result) |
|
180 | 180 | { |
181 | 181 | |
182 | 182 | // Players and team info |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | { |
136 | 136 | |
137 | 137 | // Holds the results sent back |
138 | - $results = [ ]; |
|
138 | + $results = []; |
|
139 | 139 | |
140 | 140 | // Holds the processed packets after having been reassembled |
141 | - $processed = [ ]; |
|
141 | + $processed = []; |
|
142 | 142 | |
143 | 143 | // Start up the index for the processed |
144 | 144 | $sequence_id_last = 0; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // Now we need to call the proper method |
183 | 183 | $results = array_merge( |
184 | 184 | $results, |
185 | - call_user_func_array([ $this, $this->responses[$sequence_id] ], [ $buffer ]) |
|
185 | + call_user_func_array([$this, $this->responses[$sequence_id]], [$buffer]) |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | protected function decode(Buffer $buffer) |
204 | 204 | { |
205 | 205 | |
206 | - $items = [ ]; |
|
206 | + $items = []; |
|
207 | 207 | |
208 | 208 | // Get the number of words in this buffer |
209 | 209 | $itemCount = $buffer->readInt32(); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | * @return string |
52 | 52 | * @throws \GameQ\Exception\Protocol |
53 | 53 | */ |
54 | - protected function processPackets($packet_id, array $packets = [ ]) |
|
54 | + protected function processPackets($packet_id, array $packets = []) |
|
55 | 55 | { |
56 | 56 | |
57 | 57 | // The response is gold source if the packets are split |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | |
109 | 109 | // Holds the processed packets |
110 | - $processed = [ ]; |
|
110 | + $processed = []; |
|
111 | 111 | |
112 | 112 | // Iterate over the packets |
113 | 113 | foreach ($this->packets_response as $response) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return array |
171 | 171 | */ |
172 | - protected function cleanPackets(array $packets = [ ]) |
|
172 | + protected function cleanPackets(array $packets = []) |
|
173 | 173 | { |
174 | 174 | |
175 | 175 | // Get the number of packets |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param \GameQ\Buffer $buffer |
223 | 223 | * @param \GameQ\Result $result |
224 | 224 | */ |
225 | - protected function processDetails(Buffer &$buffer, Result &$result) |
|
225 | + protected function processDetails(Buffer & $buffer, Result & $result) |
|
226 | 226 | { |
227 | 227 | |
228 | 228 | // We go until we hit an empty key |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param \GameQ\Buffer $buffer |
242 | 242 | * @param \GameQ\Result $result |
243 | 243 | */ |
244 | - protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) |
|
244 | + protected function processPlayersAndTeams(Buffer & $buffer, Result & $result) |
|
245 | 245 | { |
246 | 246 | |
247 | 247 | /* |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | // Set the item group |
290 | 290 | $item_group = 'teams'; |
291 | 291 | // Set the item type, rip off any trailing stuff and bad chars |
292 | - $item_type = rtrim(str_replace([ "\x00", "\x02" ], '', $item), '_t'); |
|
292 | + $item_type = rtrim(str_replace(["\x00", "\x02"], '', $item), '_t'); |
|
293 | 293 | } else { |
294 | 294 | // We can assume it is data belonging to a previously defined item |
295 | 295 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | // Let's iterate over the response items, there are a lot |
136 | 136 | foreach ($data as $key => $value) { |
137 | 137 | // Ignore root for now, that is where all of the channel/player info is housed |
138 | - if (in_array($key, [ 'root' ])) { |
|
138 | + if (in_array($key, ['root'])) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | 141 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | * @param array $data |
165 | 165 | * @param \GameQ\Result $result |
166 | 166 | */ |
167 | - protected function processChannelsAndUsers(array $data, Result &$result) |
|
167 | + protected function processChannelsAndUsers(array $data, Result & $result) |
|
168 | 168 | { |
169 | 169 | |
170 | 170 | // Let's add all of the channel information |
171 | 171 | foreach ($data as $key => $value) { |
172 | 172 | // We will handle these later |
173 | - if (in_array($key, [ 'channels', 'users' ])) { |
|
173 | + if (in_array($key, ['channels', 'users'])) { |
|
174 | 174 | // skip |
175 | 175 | continue; |
176 | 176 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | |
141 | 141 | // Results that will be returned |
142 | - $results = [ ]; |
|
142 | + $results = []; |
|
143 | 143 | |
144 | 144 | // Get the length of the server code so we can figure out how much to read later |
145 | 145 | $serverCodeLength = strlen($this->server_code); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // Now we need to call the proper method |
171 | 171 | $results = array_merge( |
172 | 172 | $results, |
173 | - call_user_func_array([ $this, $this->responses[$response_type] ], [ $buffer ]) |
|
173 | + call_user_func_array([$this, $this->responses[$response_type]], [$buffer]) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | unset($buffer); |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | // Build the server code |
122 | 122 | $this->server_code = implode('', array_map('chr', explode('.', $server->ip()))) . |
123 | - pack("S", $server->portClient()); |
|
123 | + pack("S", $server->portClient()); |
|
124 | 124 | |
125 | 125 | // Loop over the packets and update them |
126 | 126 | foreach ($this->packets as $packetType => $packet) { |
@@ -158,11 +158,11 @@ |
||
158 | 158 | * @return array |
159 | 159 | * @throws \GameQ\Exception\Protocol |
160 | 160 | */ |
161 | - protected function parseServerParameters(Buffer &$buffer) |
|
161 | + protected function parseServerParameters(Buffer & $buffer) |
|
162 | 162 | { |
163 | 163 | |
164 | 164 | // Init the parsed data array |
165 | - $parsed = [ ]; |
|
165 | + $parsed = []; |
|
166 | 166 | |
167 | 167 | // Read the number of parameters to parse |
168 | 168 | $parameterSize = $buffer->readInt32Signed(); |