Completed
Push — work-fleets ( 4ec5b3...fe2ede )
by SuperNova.WS
10:06
created
classes/userOptions.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -151,6 +151,9 @@
 block discarded – undo
151 151
   }
152 152
 
153 153
 
154
+  /**
155
+   * @param integer $user_id
156
+   */
154 157
   public function __construct($user_id) {
155 158
     $this->user_change($user_id);
156 159
   }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 
123 123
     $update_cache = false;
124 124
 
125
-    if(!empty($this->to_write)) {
126
-      foreach($this->to_write as $key => $cork) {
125
+    if (!empty($this->to_write)) {
126
+      foreach ($this->to_write as $key => $cork) {
127 127
         $value = is_array($this->data[$key]) ? serialize($this->data[$key]) : $this->data[$key]; // Сериализация для массивов при сохранении в БД
128
-        $this->to_write[$key] = "({$this->user_id}, '" . db_escape($key) . "', '" . db_escape($value) . "')";
128
+        $this->to_write[$key] = "({$this->user_id}, '".db_escape($key)."', '".db_escape($value)."')";
129 129
       }
130 130
 
131 131
       classSupernova::$gc->db->doReplaceValuesDeprecated(
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
       $update_cache = true;
144 144
     }
145 145
 
146
-    if(!empty($this->to_delete)) {
147
-      foreach($this->to_delete as $key => &$value) {
148
-        $value = is_string($key) ? "'". db_escape($key) . "'" : $key;
146
+    if (!empty($this->to_delete)) {
147
+      foreach ($this->to_delete as $key => &$value) {
148
+        $value = is_string($key) ? "'".db_escape($key)."'" : $key;
149 149
       }
150 150
 
151 151
       classSupernova::$db->doDeleteDanger(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
           'player_id' => $this->user_id,
155 155
         ),
156 156
         array(
157
-          "`option_id` IN (" . implode(',', $this->to_delete) . ")",
157
+          "`option_id` IN (".implode(',', $this->to_delete).")",
158 158
         )
159 159
       );
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
       $update_cache = true;
163 163
     }
164 164
 
165
-    if($update_cache) {
165
+    if ($update_cache) {
166 166
       $field_name = $this->cached_name();
167 167
       classSupernova::$cache->$field_name = $this->data;
168 168
     }
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
     $this->load();
182 182
   }
183 183
   protected function cached_name() {
184
-    return 'options_' . $this->user_id;
184
+    return 'options_'.$this->user_id;
185 185
   }
186 186
 
187 187
   protected function load() {
188
-    if($this->loaded) {
188
+    if ($this->loaded) {
189 189
       return;
190 190
     }
191 191
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     $this->to_write = array();
194 194
     $this->to_delete = array();
195 195
 
196
-    if(!$this->user_id) {
196
+    if (!$this->user_id) {
197 197
       $this->loaded = true;
198 198
       return;
199 199
     }
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
     $field_name = $this->cached_name();
202 202
     $a_data = classSupernova::$cache->$field_name;
203 203
 
204
-    if(!empty($a_data)) {
204
+    if (!empty($a_data)) {
205 205
       $this->data = array_replace_recursive($this->data, $a_data);
206 206
       return;
207 207
     }
208 208
 
209 209
     $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE");
210
-    while($row = db_fetch($query)) {
210
+    while ($row = db_fetch($query)) {
211 211
       // $this->data[$row['option_id']] = $row['value'];
212 212
       $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация
213 213
     }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
   }
285 285
 
286 286
   protected function cached_name() {
287
-    return 'options_' . $this->user_id;
287
+    return 'options_'.$this->user_id;
288 288
   }
289 289
 
290 290
   // TODO - serialize/unserialize options
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
     // Если в массиве индекса только один элемент - значит это просто индекс
293 293
     is_array($option_id) && count($option_id) == 1 ? $option_id = reset($option_id) : false;
294 294
 
295
-    if(!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) {
295
+    if (!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) {
296 296
       $this->load();
297 297
     }
298 298
 
299
-    if(is_array($option_id)) {
299
+    if (is_array($option_id)) {
300 300
       $result = $this->data;
301
-      foreach($option_id as $sub_key) {
302
-        if(!isset($result) || !isset($result[$sub_key])) {
301
+      foreach ($option_id as $sub_key) {
302
+        if (!isset($result) || !isset($result[$sub_key])) {
303 303
           $result = null;
304 304
           break;
305 305
         }
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
    * @param null|mixed $value
318 318
    */
319 319
   public function __set($option, $value = null) {
320
-    if(empty($option) || !$this->user_id) {
320
+    if (empty($option) || !$this->user_id) {
321 321
       return;
322 322
     }
323 323
 
324 324
     // Если в массиве индекса только один элемент - значит это просто индекс
325
-    if(is_array($option) && count($option) == 1) {
325
+    if (is_array($option) && count($option) == 1) {
326 326
       // Разворачиваем его в индекс
327 327
       $option = array(reset($option) => $value);
328 328
       unset($value);
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
 
332 332
     $to_write = array();
333 333
     // Адресация многомерного массива через массив индексов в $option
334
-    if(is_array($option) && isset($value)) {
334
+    if (is_array($option) && isset($value)) {
335 335
       $a_data = &$this->data;
336
-      foreach($option as $option_id) {
336
+      foreach ($option as $option_id) {
337 337
         !is_array($a_data[$option_id]) ? $a_data[$option_id] = array() : false;
338 338
         $a_data = &$a_data[$option_id];
339 339
       }
340
-      if($a_data != $value) {
340
+      if ($a_data != $value) {
341 341
         $a_data = $value;
342 342
         $to_write[reset($option)] = null;
343 343
       }
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
       // Пакетная запись из массива ключ -> значение
346 346
       !is_array($option) ? $option = array($option => $value) : false;
347 347
 
348
-      foreach($option as $option_id => $option_value) {
349
-        if($this->data[$option_id] !== $option_value) {
348
+      foreach ($option as $option_id => $option_value) {
349
+        if ($this->data[$option_id] !== $option_value) {
350 350
           // TODO - вынести отдельно в обработчик
351
-          if($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON &&  $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) {
352
-            sn_setcookie(SN_COOKIE . '_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
351
+          if ($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) {
352
+            sn_setcookie(SN_COOKIE.'_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
353 353
           }
354 354
 
355 355
           $this->data[$option_id] = $option_value;
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
       }
359 359
     }
360 360
 
361
-    if(!empty($to_write)) {
361
+    if (!empty($to_write)) {
362 362
       $field_name = $this->cached_name();
363 363
       classSupernova::$cache->$field_name = $this->data;
364 364
 
365
-      foreach($to_write as $option_id => &$option_value) {
365
+      foreach ($to_write as $option_id => &$option_value) {
366 366
         $option_value = is_array($this->data[$option_id]) ? serialize($this->data[$option_id]) : $this->data[$option_id]; // Сериализация для массивов при сохранении в БД
367
-        $to_write[$option_id] = "({$this->user_id}, '" . db_escape($option_id) . "', '" . db_escape($option_value) . "')";
367
+        $to_write[$option_id] = "({$this->user_id}, '".db_escape($option_id)."', '".db_escape($option_value)."')";
368 368
       }
369 369
 
370 370
       classSupernova::$gc->db->doReplaceValuesDeprecated(
@@ -380,26 +380,26 @@  discard block
 block discarded – undo
380 380
   }
381 381
 
382 382
   protected function load() {
383
-    if($this->loaded) {
383
+    if ($this->loaded) {
384 384
       return;
385 385
     }
386 386
 
387 387
     $this->data = $this->defaults;
388 388
 
389
-    if(!$this->user_id) {
389
+    if (!$this->user_id) {
390 390
       return;
391 391
     }
392 392
 
393 393
     $field_name = $this->cached_name();
394 394
     $a_data = classSupernova::$cache->$field_name;
395 395
 
396
-    if(!empty($a_data)) {
396
+    if (!empty($a_data)) {
397 397
       $this->data = array_replace($this->data, $a_data);
398 398
       return;
399 399
     }
400 400
 
401 401
     $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE");
402
-    while($row = db_fetch($query)) {
402
+    while ($row = db_fetch($query)) {
403 403
       // $this->data[$row['option_id']] = $row['value'];
404 404
       $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация
405 405
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     return $this->__get($offset);
416 416
   }
417 417
   public function offsetSet($offset, $value) {
418
-    if(!is_null($offset)) {
418
+    if (!is_null($offset)) {
419 419
       // $this->data[$offset] = $value;
420 420
       $this->__set($offset, $value);
421 421
     } else {
Please login to merge, or discard this patch.
classes/V2Fleet/V2FleetModel.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,7 @@
 block discarded – undo
5 5
 
6 6
 namespace V2Fleet;
7 7
 
8
-use V2Unit\V2UnitContainer;
9 8
 use V2Unit\V2UnitList;
10
-use V2Unit\V2UnitModel;
11 9
 use Vector\Vector;
12 10
 
13 11
 /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
       )
145 145
     );
146 146
 
147
-    $this->accessors->setAccessor('units', P_CONTAINER_GET, function (V2FleetContainer $that) {
147
+    $this->accessors->setAccessor('units', P_CONTAINER_GET, function(V2FleetContainer $that) {
148 148
       if (is_null($units = $that->getDirect('units'))) {
149 149
         $units = new V2UnitList();
150 150
         $that->setDirect('units', $units);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
       return $units;
154 154
     });
155 155
 
156
-    $this->accessors->setAccessor('isReturning', P_CONTAINER_GET, function (V2FleetContainer $that) {
156
+    $this->accessors->setAccessor('isReturning', P_CONTAINER_GET, function(V2FleetContainer $that) {
157 157
       return $that->status == 1;
158 158
     });
159 159
 
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
   public function importVector(V2FleetContainer $that, $propertyName, $fieldName) {
167 167
     $prefix = $propertyName == 'vectorDeparture' ? 'fleet_start_' : 'fleet_end_';
168 168
     $that->$propertyName = new Vector(
169
-      $that->row[$prefix . 'galaxy'],
170
-      $that->row[$prefix . 'system'],
171
-      $that->row[$prefix . 'planet'],
172
-      $that->row[$prefix . 'type']
169
+      $that->row[$prefix.'galaxy'],
170
+      $that->row[$prefix.'system'],
171
+      $that->row[$prefix.'planet'],
172
+      $that->row[$prefix.'type']
173 173
     );
174 174
   }
175 175
 
176 176
   public function exportVector(V2FleetContainer $that, $propertyName, $fieldName) {
177 177
     $prefix = $propertyName == 'vectorDeparture' ? 'fleet_start_' : 'fleet_end_';
178
-    $that->row[$prefix . 'galaxy'] = $that->$propertyName->galaxy;
179
-    $that->row[$prefix . 'system'] = $that->$propertyName->system;
180
-    $that->row[$prefix . 'planet'] = $that->$propertyName->planet;
181
-    $that->row[$prefix . 'type'] = $that->$propertyName->type;
178
+    $that->row[$prefix.'galaxy'] = $that->$propertyName->galaxy;
179
+    $that->row[$prefix.'system'] = $that->$propertyName->system;
180
+    $that->row[$prefix.'planet'] = $that->$propertyName->planet;
181
+    $that->row[$prefix.'type'] = $that->$propertyName->type;
182 182
   }
183 183
 
184 184
   /**
Please login to merge, or discard this patch.
classes/V2Unit/V2UnitList.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@
 block discarded – undo
18 18
   protected $unitBySnId;
19 19
 
20 20
   /**
21
+   * @param integer $locationType
21 22
    */
22 23
   public function load($locationType, $locationId) {
23 24
 
Please login to merge, or discard this patch.
classes/RequestInfo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
     // Инфа об устройстве и браузере - общая для всех
88 88
     sn_db_transaction_start();
89 89
     $this->device_cypher = $_COOKIE[SN_COOKIE_D];
90
-    if($this->device_cypher) {
90
+    if ($this->device_cypher) {
91 91
       $cypher_safe = db_escape($this->device_cypher);
92 92
       $device_id = classSupernova::$db->doSelectFetch("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE");
93
-      if(!empty($device_id['device_id'])) {
93
+      if (!empty($device_id['device_id'])) {
94 94
         $this->device_id = $device_id['device_id'];
95 95
       }
96 96
     }
97 97
 
98
-    if($this->device_id <= 0) {
98
+    if ($this->device_id <= 0) {
99 99
       do {
100 100
         $cypher_safe = db_escape($this->device_cypher = sys_random_string());
101 101
         $row = classSupernova::$db->doSelectFetch("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE");
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string');
119 119
     sn_db_transaction_commit();
120 120
 
121
-    if($this->write_full_url) {
121
+    if ($this->write_full_url) {
122 122
       sn_db_transaction_start();
123 123
       $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE));
124
-      if(strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
124
+      if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
125 125
         $this->page_url = '/simulator.php';
126 126
       }
127 127
       $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string');
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public function db_security_entry_insert($user_id_unsafe) {
146 146
     // TODO $user_id = !empty(self::$user['id']) ? self::$user['id'] : 'NULL';
147
-    if(empty($user_id_unsafe)) {
147
+    if (empty($user_id_unsafe)) {
148 148
       // self::flog('Нет ИД пользователя');
149 149
       return true;
150 150
     }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
   public function db_counter_insert($user_id_unsafe) {
167 167
     global $sys_stop_log_hit;
168 168
 
169
-    if($sys_stop_log_hit || !classSupernova::$config->game_counter) {
169
+    if ($sys_stop_log_hit || !classSupernova::$config->game_counter) {
170 170
       return;
171 171
     }
172 172
 
Please login to merge, or discard this patch.
classes/FleetList.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
     $fleets_added = array();
34 34
 
35 35
     $query = doquery(
36
-      "SELECT * FROM `{{fleets}}`" .
37
-      (!empty($where_safe) ? " WHERE {$where_safe}" : '') .
36
+      "SELECT * FROM `{{fleets}}`".
37
+      (!empty($where_safe) ? " WHERE {$where_safe}" : '').
38 38
       " FOR UPDATE;"
39 39
     );
40
-    while($row = db_fetch($query)) {
40
+    while ($row = db_fetch($query)) {
41 41
       /**
42 42
        * @var Fleet $fleet
43 43
        */
44 44
       $fleet = $this->_createElement();
45 45
       $fleet->dbRowParse($row);
46 46
 
47
-      if(isset($this[$fleet->dbId])) {
47
+      if (isset($this[$fleet->dbId])) {
48 48
         // Нужно ли ????
49 49
         classSupernova::$debug->error('Fleet list already set');
50 50
       }
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
   public static function dbGetFleetListCurrentTick() {
122 122
     return static::dbGetFleetList(
123 123
       "
124
-    (`fleet_start_time` <= " . SN_TIME_NOW . " AND `fleet_mess` = 0)
124
+    (`fleet_start_time` <= " . SN_TIME_NOW." AND `fleet_mess` = 0)
125 125
     OR
126
-    (`fleet_end_stay` <= " . SN_TIME_NOW . " AND `fleet_end_stay` > 0 AND `fleet_mess` = 0)
126
+    (`fleet_end_stay` <= " . SN_TIME_NOW." AND `fleet_end_stay` > 0 AND `fleet_mess` = 0)
127 127
     OR
128
-    (`fleet_end_time` <= " . SN_TIME_NOW . ")");
128
+    (`fleet_end_time` <= " . SN_TIME_NOW.")");
129 129
   }
130 130
 
131 131
   /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     AND `fleet_end_planet` = {$planet_row['planet']}
146 146
     AND `fleet_end_type`   = {$planet_row['planet_type']}
147 147
     AND `fleet_owner` = {$fleet_owner_id}
148
-    AND `fleet_mission` IN (" . MT_ATTACK . "," . MT_ACS . "," . MT_DESTROY . ")
148
+    AND `fleet_mission` IN (".MT_ATTACK.",".MT_ACS.",".MT_DESTROY.")
149 149
     AND `fleet_mess` = 0"
150 150
     );
151 151
   }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
    * @return static
171 171
    */
172 172
   public static function dbGetFleetListAndMissileByCoordinates($coordinates, $for_phalanx = false) {
173
-    if(empty($coordinates) || !is_array($coordinates)) {
173
+    if (empty($coordinates) || !is_array($coordinates)) {
174 174
       return array();
175 175
     }
176 176
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
      * @var Fleet[] $array_of_Fleet
200 200
      */
201 201
     $array_of_Fleet = array();
202
-    if(!empty($fleet_db_list) && $fleet_db_list->count()) {
203
-      foreach($fleet_db_list->_container as $fleet_id => $objFleet) {
202
+    if (!empty($fleet_db_list) && $fleet_db_list->count()) {
203
+      foreach ($fleet_db_list->_container as $fleet_id => $objFleet) {
204 204
         $array_of_Fleet[$fleet_id] = $objFleet;
205 205
       }
206 206
       $planet_fleets = flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet);
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
     return static::dbGetFleetList(
226 226
       "(
227 227
       fleet_start_galaxy = {$galaxy}
228
-      AND fleet_start_system = {$system}" .
229
-      ($planet ? " AND fleet_start_planet = {$planet}" : '') .
230
-      ($planet_type != PT_ALL ? " AND fleet_start_type = {$planet_type}" : '') .
231
-      ($for_phalanx ? '' : " AND fleet_mess = 1") .
228
+      AND fleet_start_system = {$system}".
229
+      ($planet ? " AND fleet_start_planet = {$planet}" : '').
230
+      ($planet_type != PT_ALL ? " AND fleet_start_type = {$planet_type}" : '').
231
+      ($for_phalanx ? '' : " AND fleet_mess = 1").
232 232
       ") OR (
233 233
       fleet_end_galaxy = {$galaxy}
234
-      AND fleet_end_system = {$system}" .
235
-      ($planet ? " AND fleet_end_planet = {$planet}" : '') .
236
-      ($planet_type != PT_ALL ? " AND fleet_end_type = {$planet_type} " : '') .
237
-      ($for_phalanx ? '' : " AND fleet_mess = 0") .
234
+      AND fleet_end_system = {$system}".
235
+      ($planet ? " AND fleet_end_planet = {$planet}" : '').
236
+      ($planet_type != PT_ALL ? " AND fleet_end_type = {$planet_type} " : '').
237
+      ($for_phalanx ? '' : " AND fleet_mess = 0").
238 238
       ")"
239 239
     );
240 240
   }
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
    */
247 247
   public function dbMergeMissileList($where) {
248 248
     $query = doquery(
249
-      "SELECT * FROM `{{iraks}}`" .
250
-      (!empty($where) ? " WHERE {$where}" : '') .
249
+      "SELECT * FROM `{{iraks}}`".
250
+      (!empty($where) ? " WHERE {$where}" : '').
251 251
       " FOR UPDATE;");
252
-    while($missile_db_row = db_fetch($query)) {
252
+    while ($missile_db_row = db_fetch($query)) {
253 253
       /**
254 254
        * @var Fleet $objFleet
255 255
        */
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
    */
272 272
   public static function dbGetFleetListAndMissileINCOMING($owner_id) {
273 273
     $owner_id_safe = idval($owner_id);
274
-    if(empty($owner_id_safe)) {
274
+    if (empty($owner_id_safe)) {
275 275
       return array();
276 276
     }
277 277
 
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
    */
306 306
   public static function fleet_count_flying($player_id, $mission_id = 0) {
307 307
     $player_id_safe = idval($player_id);
308
-    if(!empty($player_id_safe)) {
308
+    if (!empty($player_id_safe)) {
309 309
       $mission_id_safe = intval($mission_id);
310 310
       $result = static::db_fleet_count(
311
-        "`fleet_owner` = {$player_id_safe}" .
311
+        "`fleet_owner` = {$player_id_safe}".
312 312
         ($mission_id_safe ? " AND `fleet_mission` = {$mission_id_safe}" : '')
313 313
       );
314 314
     } else {
Please login to merge, or discard this patch.
classes/PlayerList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
    * @version 41a6.16
24 24
    */
25 25
   protected function db_load_player_by_id($player_id) {
26
-    if(isset($this[$player_id])) {
26
+    if (isset($this[$player_id])) {
27 27
       return;
28 28
     }
29 29
 
Please login to merge, or discard this patch.
classes/UBE/UBEPlayerList.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
       UBE_PLAYER_IS_DEFENDER => array(),
56 56
     );
57 57
 
58
-    foreach($this->_container as $player_id => $UBEPlayer) {
58
+    foreach ($this->_container as $player_id => $UBEPlayer) {
59 59
       $result[$UBEPlayer->getSide() ? UBE_PLAYER_IS_ATTACKER : UBE_PLAYER_IS_DEFENDER][$player_id] = $UBEPlayer->getDbRow();
60 60
     }
61 61
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
    */
71 71
   public function get_first_player_on_side($side) {
72 72
     $result = null;
73
-    foreach($this->_container as $player_id => $UBEPlayer) {
74
-      if($UBEPlayer->getSide() == $side) {
73
+    foreach ($this->_container as $player_id => $UBEPlayer) {
74
+      if ($UBEPlayer->getSide() == $side) {
75 75
         $result = $UBEPlayer;
76 76
         break;
77 77
       }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
    */
89 89
   public function get_player_sides() {
90 90
     $result = array();
91
-    foreach($this->_container as $player_id => $UBEPlayer) {
91
+    foreach ($this->_container as $player_id => $UBEPlayer) {
92 92
       $result[$player_id] = $UBEPlayer->getSide() ? UBE_PLAYER_IS_ATTACKER : UBE_PLAYER_IS_DEFENDER;
93 93
     }
94 94
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   }
97 97
 
98 98
   public function ubeLoadPlayersAndSetSideFromFleetIdList(array $added_fleets, UBEFleetList $fleetList, $side = UBE_PLAYER_IS_DEFENDER) {
99
-    foreach($added_fleets as $fleet_id) {
99
+    foreach ($added_fleets as $fleet_id) {
100 100
       $this->db_load_player_by_id($fleetList[$fleet_id]->owner_id, $side);
101 101
     }
102 102
   }
Please login to merge, or discard this patch.
classes/UBE/UBEDebug.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
    * @version 41a6.49
12 12
    */
13 13
   public static function unit_dump_header() {
14
-    if(!defined('DEBUG_UBE')) {
14
+    if (!defined('DEBUG_UBE')) {
15 15
       return;
16 16
     }
17 17
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
    * @version 41a6.49
49 49
    */
50 50
   public static function unit_dump(UBEUnit $unit, $desc = '', UBEUnit $before = null) {
51
-    if(!defined('DEBUG_UBE')) {
51
+    if (!defined('DEBUG_UBE')) {
52 52
       return;
53 53
     }
54 54
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 //  print("<td>" . $this->units_lost . "</td>");
76 76
 //  print("<td>" . $this->units_restored . "</td>");
77 77
 //  print("<td>" . $this->capacity . "</td>");
78
-    print("<td>" . round($unit->share_of_side_armor, 4) . "</td>");
78
+    print("<td>".round($unit->share_of_side_armor, 4)."</td>");
79 79
     print('</tr>');
80 80
   }
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @version 41a6.49
87 87
    */
88 88
   public static function unit_dump_footer() {
89
-    if(!defined('DEBUG_UBE')) {
89
+    if (!defined('DEBUG_UBE')) {
90 90
       return;
91 91
     }
92 92
 
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
    * @return UBEUnit
102 102
    */
103 103
   public static function unit_dump_defender(UBEUnit $attacking_unit_pool, UBEUnit $defending_unit_pool, $defending_fleet_id) {
104
-    if(!defined('DEBUG_UBE')) {
104
+    if (!defined('DEBUG_UBE')) {
105 105
       return null;
106 106
     }
107 107
 
108 108
     $classLocale = classLocale::$lang;
109 109
 
110
-    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}" .
111
-      ' attacks ' .
112
-      $defending_fleet_id . '@' . "[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}" .
113
-      ' with ' . pretty_number($defending_unit_pool->attack_income) .
110
+    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}".
111
+      ' attacks '.
112
+      $defending_fleet_id.'@'."[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}".
113
+      ' with '.pretty_number($defending_unit_pool->attack_income).
114 114
       '<br>'
115 115
     );
116 116
     $before = clone $defending_unit_pool;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
    * @version 41a6.49
128 128
    */
129 129
   public static function unit_dump_delta(UBEUnit $unit, $field, UBEUnit $before = null) {
130
-    if(!defined('DEBUG_UBE')) {
130
+    if (!defined('DEBUG_UBE')) {
131 131
       return;
132 132
     }
133 133
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
     print(pretty_number($unit->$field));
137 137
     print("</td>");
138 138
     print("<td>");
139
-    if(!empty($before)) {
140
-      print('' . pretty_number($unit->$field - $before->$field) . '');
139
+    if (!empty($before)) {
140
+      print(''.pretty_number($unit->$field - $before->$field).'');
141 141
     }
142 142
     print("</td>");
143 143
   }
Please login to merge, or discard this patch.
classes/UBE/UBERound.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
    * @version 2016-02-25 23:42:45 41a4.68
37 37
    */
38 38
   public function make_snapshot(UBEFleetList $UBEFleetList) {
39
-    foreach($UBEFleetList->_container as $fleet_id => $UBEFleet) {
40
-      foreach($UBEFleet->unit_list->_container as $UBEUnit) {
39
+    foreach ($UBEFleetList->_container as $fleet_id => $UBEFleet) {
40
+      foreach ($UBEFleet->unit_list->_container as $UBEUnit) {
41 41
         $this->snapshot[$fleet_id][$UBEUnit->unitId] = new UBESnapshotUnit();
42 42
         $this->snapshot[$fleet_id][$UBEUnit->unitId]->init_from_UBEUnit($UBEUnit);
43 43
       }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
    * @version 2016-02-25 23:42:45 41a4.68
54 54
    */
55 55
   public function sql_generate_unit_array(array &$sql_perform_ube_report_unit, &$unit_sort_order, UBEFleetList $UBEFleetList, array $outer_prefix) {
56
-    foreach($this->snapshot as $fleet_id => $fleet_snapshot) {
56
+    foreach ($this->snapshot as $fleet_id => $fleet_snapshot) {
57 57
       $inner_prefix = array(
58 58
         $UBEFleetList[$fleet_id]->owner_id,
59 59
         $fleet_id,
60 60
       );
61
-      foreach($fleet_snapshot as $unit_id => $unit_snapshot) {
61
+      foreach ($fleet_snapshot as $unit_id => $unit_snapshot) {
62 62
         $sql_perform_ube_report_unit[] = array_merge(
63 63
           $outer_prefix,
64 64
           $inner_prefix,
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
       UBE_PLAYER_IS_DEFENDER => array(),
102 102
     );
103 103
 
104
-    foreach($this->snapshot as $fleet_id => $fleet_snapshot) {
104
+    foreach ($this->snapshot as $fleet_id => $fleet_snapshot) {
105 105
       $fleet_owner_id = $ube->fleet_list[$fleet_id]->owner_id;
106 106
       $planet_ube_row = $ube->fleet_list[$fleet_id]->UBE_PLANET;
107 107
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
         'PLAYER_NAME' => htmlentities($ube->players[$fleet_owner_id]->name, ENT_COMPAT, 'UTF-8'),
112 112
       );
113 113
 
114
-      if(is_array($planet_ube_row)) {
114
+      if (is_array($planet_ube_row)) {
115 115
         $template_fleet += $planet_ube_row;
116 116
         $template_fleet[PLANET_NAME] = $template_fleet[PLANET_NAME] ? htmlentities($template_fleet[PLANET_NAME], ENT_COMPAT, 'UTF-8') : '';
117 117
         $template_fleet['PLANET_TYPE_TEXT'] = $lang['sys_planet_type_sh'][$template_fleet['PLANET_TYPE']];
118 118
       }
119 119
 
120
-      foreach($fleet_snapshot as $unit_id => $unit_snapshot) {
120
+      foreach ($fleet_snapshot as $unit_id => $unit_snapshot) {
121 121
         $template_fleet['.']['ship'][] = $unit_snapshot->report_render_unit($prevSnapshot[$fleet_id][$unit_id]);
122 122
       }
123 123
 
Please login to merge, or discard this patch.