Completed
Push — work-fleets ( cb2521...9eb2f3 )
by SuperNova.WS
08:26
created
classes/oldArrayAccessNd.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     !is_array($offset) ? $offset = array($offset) : false;
39 39
 
40 40
     $current_leaf = $this->__get(reset($offset));
41
-    while(($leaf_index = next($offset)) !== false) {
42
-      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
41
+    while (($leaf_index = next($offset)) !== false) {
42
+      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
43 43
         unset($current_leaf);
44 44
         break;
45 45
       }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
     !is_array($offset) ? $offset = array($offset) : false;
66 66
 
67
-    if($this->offsetExists($offset)) {
67
+    if ($this->offsetExists($offset)) {
68 68
       $result = $this->__get(reset($offset));
69
-      while(($leaf_index = next($offset)) !== false) {
69
+      while (($leaf_index = next($offset)) !== false) {
70 70
         $result = $result[$leaf_index];
71 71
       }
72 72
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function offsetSet($offset, $value = null) {
93 93
     // Если нет никакого индекса - значит нечего записывать
94
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
94
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
95 95
       return;
96 96
     }
97 97
 
98 98
     // Если в массиве индекса только один элемент - значит это просто индекс
99
-    if(is_array($offset) && count($offset) == 1) {
99
+    if (is_array($offset) && count($offset) == 1) {
100 100
       // Разворачиваем его в индекс
101 101
       $offset = array(reset($offset) => $value);
102 102
       unset($value);
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     // Адресация многомерного массива через массив индексов в $option
107
-    if(is_array($offset) && isset($value)) {
107
+    if (is_array($offset) && isset($value)) {
108 108
       // TODO - а не переделать ли это всё на __isset() ??
109 109
 //pdump($offset, '$offset');
110 110
 //pdump($value, '$value');
111 111
       // Вытаскиваем корневой элемент
112 112
       $root = $this->__get(reset($offset));
113 113
       $current_leaf = &$root;
114
-      while(($leaf_index = next($offset)) !== false) {
114
+      while (($leaf_index = next($offset)) !== false) {
115 115
         !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false;
116 116
         $current_leaf = &$current_leaf[$leaf_index];
117 117
       }
118 118
 //pdump($current_leaf, '$current_leaf');
119 119
 //pdump($value, '$value');
120
-      if($current_leaf != $value) {
120
+      if ($current_leaf != $value) {
121 121
         $current_leaf = $value;
122 122
 //pdump(reset($offset), 'reset($offset)');
123 123
 //pdump($root, '$root');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       // Пакетная запись из массива ключ -> значение
129 129
       !is_array($offset) ? $offset = array($offset => $value) : false;
130 130
 
131
-      foreach($offset as $key => $value) {
131
+      foreach ($offset as $key => $value) {
132 132
         $this->__get($key) !== $value ? $this->__set($key, $value) : false;
133 133
       }
134 134
     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
    */
150 150
   public function offsetUnset($offset) {
151 151
     // Если нет никакого индекса - значит нечего записывать
152
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
152
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
153 153
       return;
154 154
     }
155 155
 
156 156
     !is_array($offset) ? $offset = array($offset) : false;
157 157
 
158
-    if($this->offsetExists($offset)) {
158
+    if ($this->offsetExists($offset)) {
159 159
 //pdump($offset);
160 160
       // Перематываем массив в конец
161 161
       $key_to_delete = end($offset);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 //pdump($key_to_delete, '$key_to_delete');
164 164
       $parent_offset = $offset;
165 165
       array_pop($parent_offset);
166
-      if(!count($parent_offset)) {
166
+      if (!count($parent_offset)) {
167 167
         // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент
168 168
         $this->__unset($key_to_delete);
169 169
       } else {
Please login to merge, or discard this patch.
classes/Fleet.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -421,31 +421,31 @@  discard block
 block discarded – undo
421 421
 
422 422
     return classSupernova::$db->doSelect(
423 423
     // Блокировка самого флота
424
-      "SELECT 1 FROM {{fleets}} AS f " .
424
+      "SELECT 1 FROM {{fleets}} AS f ".
425 425
 
426 426
       // Блокировка всех юнитов, принадлежащих этому флоту
427
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
427
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
428 428
 
429 429
       // Блокировка всех прилетающих и улетающих флотов, если нужно
430 430
       // TODO - lock fleets by COORDINATES
431
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
431
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
432 432
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
433
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
433
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
434 434
 
435
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
435
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
436 436
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
437
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
437
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
438 438
       // Блокировка планеты-цели
439
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
439
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
440 440
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
441 441
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
442 442
 
443 443
 
444
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
444
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
445 445
       // Блокировка всех юнитов, принадлежащих владельцу флота
446
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
446
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
447 447
       // Блокировка планеты отправления
448
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
448
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
449 449
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
450 450
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
451 451
 
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
   public function dbGetLockById($dbId) {
463 463
     classSupernova::$db->doSelect(
464 464
     // Блокировка самого флота
465
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
465
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
466 466
       // Lock fleet owner
467
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
467
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
468 468
       // Блокировка всех юнитов, принадлежащих этому флоту
469
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
469
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
470 470
 
471 471
       // Без предварительной выборки неизвестно - куда летит этот флот.
472 472
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
483 483
       " .
484 484
       // Блокировка всех юнитов, принадлежащих этим флотам
485
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
485
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
486 486
       // Lock fleet owner
487
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
487
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
488 488
 
489 489
       "LEFT JOIN {{fleets}} AS FLEET2 ON
490 490
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
       " .
495 495
       // Блокировка всех юнитов, принадлежащих этим флотам
496 496
       "LEFT JOIN {{unit}} as UNIT2 ON
497
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
497
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
498 498
         UNIT2.unit_location_id = FLEET2.fleet_id
499 499
       " .
500 500
       // Lock fleet owner
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
       " .
512 512
       // Блокировка всех юнитов, принадлежащих этим флотам
513 513
       "LEFT JOIN {{unit}} as UNIT3 ON
514
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
514
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
515 515
         UNIT3.unit_location_id = FLEET3.fleet_id
516 516
       " .
517 517
       // Lock fleet owner
518
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
518
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
519 519
 
520 520
       "LEFT JOIN {{fleets}} AS FLEET4 ON
521 521
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
       " .
526 526
       // Блокировка всех юнитов, принадлежащих этим флотам
527 527
       "LEFT JOIN {{unit}} as UNIT4 ON
528
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
528
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
529 529
         UNIT4.unit_location_id = FLEET4.fleet_id
530 530
       " .
531 531
       // Lock fleet owner
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
       " .
548 548
       // Блокировка всех юнитов, принадлежащих этой планете
549 549
       "LEFT JOIN {{unit}} as UNIT5 ON
550
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
550
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
551 551
         UNIT5.unit_location_id = PLANETS5.id
552 552
       " .
553 553
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
       " .
566 566
       // Блокировка всех юнитов, принадлежащих этой планете
567 567
       "LEFT JOIN {{unit}} as UNIT6 ON
568
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
568
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
569 569
         UNIT6.unit_location_id = PLANETS6.id
570 570
       " .
571 571
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
       } elseif ($this->isResource($unit_id)) {
685 685
         $this->resource_list[$unit_id] = $unit_count;
686 686
       } else {
687
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
687
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
688 688
       }
689 689
     }
690 690
   }
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
    * @param int $unit_count
819 819
    */
820 820
   public function shipSetCount($unit_id, $unit_count = 0) {
821
-    pdump(__CLASS__ . '->' . __FUNCTION__);
821
+    pdump(__CLASS__.'->'.__FUNCTION__);
822 822
     $this->shipAdjustCount($unit_id, $unit_count, true);
823 823
   }
824 824
 
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
    */
1017 1017
   public function resourcesSet($resource_list) {
1018 1018
     if (!empty($this->propertiesAdjusted['resource_list'])) {
1019
-      throw new ExceptionPropertyAccess('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
1019
+      throw new ExceptionPropertyAccess('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
1020 1020
     }
1021 1021
     $this->resourcesAdjust($resource_list, true);
1022 1022
   }
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
       // Check for negative unit value
1051 1051
       if ($this->resource_list[$resource_id] < 0) {
1052 1052
         // TODO
1053
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1053
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1054 1054
       }
1055 1055
     }
1056 1056
   }
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
   protected function printErrorIfNoShips() {
1239 1239
     if ($this->unitList->unitsCount() <= 0) {
1240
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
1240
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
1241 1241
     }
1242 1242
   }
1243 1243
 
@@ -1625,14 +1625,14 @@  discard block
 block discarded – undo
1625 1625
       if (FLIGHT_ALLOWED == $validateResult[$missionType]) {
1626 1626
         $this->allowed_missions[$missionType] = $mission;
1627 1627
       } else {
1628
-        if($missionType == $this->mission_type) {
1628
+        if ($missionType == $this->mission_type) {
1629 1629
         }
1630 1630
         unset($this->allowed_missions[$missionType]);
1631 1631
       }
1632 1632
     }
1633 1633
 
1634
-    if(empty($this->allowed_missions)) {
1635
-      if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1634
+    if (empty($this->allowed_missions)) {
1635
+      if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1636 1636
         throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]);
1637 1637
       } else {
1638 1638
         throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE);
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
     $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob);
1865 1865
 
1866 1866
     $template_result += array(
1867
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1867
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1868 1868
       'dist'            => pretty_number($this->travelData['distance']),
1869 1869
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1870 1870
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.
classes/auth_abstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
    */
36 36
   // OK 4.9
37 37
   public function __construct($filename = __FILE__) {
38
-    if($this->provider_id == ACCOUNT_PROVIDER_NONE) {
38
+    if ($this->provider_id == ACCOUNT_PROVIDER_NONE) {
39 39
       die('У всех провайдеров должен быть $provider_id!');
40 40
     }
41 41
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
   // OK 4.6
134 134
   public function player_name_suggest() {
135 135
     $name = '';
136
-    if(is_object($this->account) && !empty($this->account->account_email)) {
136
+    if (is_object($this->account) && !empty($this->account->account_email)) {
137 137
       list($name) = explode('@', $this->account->account_email);
138 138
     }
139 139
 
Please login to merge, or discard this patch.
classes/Confirmation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
       // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true);
42 42
       // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем"
43 43
       $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true);
44
-    } while($query);
44
+    } while ($query);
45 45
 
46 46
     $this->db->doquery(
47 47
       "REPLACE INTO {{confirmations}}
Please login to merge, or discard this patch.
classes/Player.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
    * @return int|mixed
229 229
    */
230 230
   public function calcColonyMaxCount($astrotech = -1) {
231
-    if($astrotech == -1) {
232
-      if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
231
+    if ($astrotech == -1) {
232
+      if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
233 233
 
234 234
         $expeditions = get_player_max_expeditons($this->_dbRow);
235 235
         $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 
304 304
   public function expeditionsMax() {
305
-    if($this->expeditionsMax === null) {
305
+    if ($this->expeditionsMax === null) {
306 306
       $this->expeditionsMax = get_player_max_expeditons($this->_dbRow);
307 307
     }
308 308
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
   }
311 311
 
312 312
   public function expeditionsFlying() {
313
-    if($this->expeditionsFlying === null) {
313
+    if ($this->expeditionsFlying === null) {
314 314
       $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE);
315 315
     }
316 316
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 
321 321
   public function fleetsMax() {
322
-    if($this->fleetMax === null) {
322
+    if ($this->fleetMax === null) {
323 323
       $this->fleetMax = GetMaxFleets($this->_dbRow);
324 324
     }
325 325
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
   }
328 328
 
329 329
   public function fleetsFlying() {
330
-    if($this->fleetFlying === null) {
330
+    if ($this->fleetFlying === null) {
331 331
       $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId);
332 332
     }
333 333
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
   public function coloniesMax() {
339
-    if($this->coloniesMax === null) {
339
+    if ($this->coloniesMax === null) {
340 340
       $this->coloniesMax = get_player_max_colonies($this->_dbRow);
341 341
     }
342 342
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
   }
345 345
 
346 346
   public function coloniesCurrent() {
347
-    if($this->coloniesCurrent === null) {
347
+    if ($this->coloniesCurrent === null) {
348 348
       $this->coloniesCurrent = get_player_current_colonies($this->_dbRow);
349 349
     }
350 350
 
Please login to merge, or discard this patch.
classes/PlayerToAccountTranslate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   protected static $is_init = false;
20 20
 
21 21
   protected static function init() {
22
-    if(!empty(static::$db)) {
22
+    if (!empty(static::$db)) {
23 23
       return;
24 24
     }
25 25
     static::$db = classSupernova::$db;
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     $provider_id_safe = intval($provider_id_unsafe);
67 67
     !is_array($account_list) ? $account_list = array($account_list) : false;
68 68
 
69
-    foreach($account_list as $provider_account_id_unsafe) {
69
+    foreach ($account_list as $provider_account_id_unsafe) {
70 70
       $provider_account_id_safe = intval($provider_account_id_unsafe);
71 71
 
72 72
       // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером
73 73
       $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE");
74
-      while($row = static::$db->db_fetch($query)) {
74
+      while ($row = static::$db->db_fetch($query)) {
75 75
         $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true;
76 76
       }
77 77
     }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
     $account_translation = array();
89 89
 
90 90
     $query = static::$db->doquery(
91
-      "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " .
92
-      ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') .
91
+      "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} ".
92
+      ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '').
93 93
       "ORDER BY `timestamp` FOR UPDATE");
94
-    while($row = static::$db->db_fetch($query)) {
94
+    while ($row = static::$db->db_fetch($query)) {
95 95
       $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row;
96 96
     }
97 97
 
Please login to merge, or discard this patch.
classes/Bonus.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
    * @param $unit_level
29 29
    */
30 30
   public function add_unit_by_snid($unit_id, $unit_level) {
31
-    if(!$unit_level) {
31
+    if (!$unit_level) {
32 32
       return;
33 33
     }
34 34
 
35
-    foreach(static::$_bonus_group as $param_name => $unit_list) {
36
-      if(!empty($unit_list[$unit_id])) {
35
+    foreach (static::$_bonus_group as $param_name => $unit_list) {
36
+      if (!empty($unit_list[$unit_id])) {
37 37
         // Простейший вариант - мультипликатор по базе
38 38
         // Общий мультипликатор добавляется в конец
39 39
         $this->grants[$param_name][$unit_id] = $unit_level;
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 //    $this->grants[$param_name][$unit_id] = $unit_level * get_unit_param($unit_id, P_BONUS_VALUE) / 100;;
83 83
     $value_add = floatval($base_value);
84 84
     $cumulative = 1.0; // Для случая BONUS_PERCENT
85
-    if(!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
-      foreach($this->grants[$param] as $unit_id => $unit_level) {
85
+    if (!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
+      foreach ($this->grants[$param] as $unit_id => $unit_level) {
87 87
         $unit_bonus = 0;
88
-        if($unit_id < 0) {
88
+        if ($unit_id < 0) {
89 89
           // Meta-unit - leave as is
90 90
         } else {
91 91
           // TODO - Подумать, что будет при смешивании разных бонусов и как этого избежать
92 92
           $bonus_value = get_unit_param($unit_id, P_BONUS_VALUE);
93 93
           $bonus_type = get_unit_param($unit_id, P_BONUS_TYPE);
94
-          switch($bonus_type) {
94
+          switch ($bonus_type) {
95 95
             case BONUS_PERCENT:
96 96
               $unit_bonus = $unit_level * $bonus_value / 100;
97 97
               $cumulative += $unit_bonus;
Please login to merge, or discard this patch.
classes/Common/ContainerPlus.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
    * @return bool
39 39
    */
40 40
   public function isEmpty() {
41
-    throw new \Exception(get_class() . '::isEmpty() not implemented - inherited from ContainerPlus');
41
+    throw new \Exception(get_class().'::isEmpty() not implemented - inherited from ContainerPlus');
42 42
   }
43 43
 
44 44
   /**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
    * @return mixed
48 48
    */
49 49
   public function clear() {
50
-    throw new \Exception(get_class() . '::clear() not implemented - inherited from ContainerPlus');
50
+    throw new \Exception(get_class().'::clear() not implemented - inherited from ContainerPlus');
51 51
   }
52 52
 
53 53
 }
Please login to merge, or discard this patch.
classes/Common/Types.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
    */
13 13
   public function castAs($type, $value) {
14 14
     // TODO: Here should be some conversions to property type
15
-    switch($type) {
15
+    switch ($type) {
16 16
       case TYPE_INTEGER:
17 17
         $value = intval($value);
18 18
       break;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
       break;
31 31
 
32 32
       case TYPE_ARRAY:
33
-        $value = (array)$value;
33
+        $value = (array) $value;
34 34
       break;
35 35
 
36 36
       case TYPE_STRING:
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
       case TYPE_EMPTY:
39 39
         // No-type defaults to string
40 40
       default:
41
-        $value = (string)$value;
41
+        $value = (string) $value;
42 42
       break;
43 43
     }
44 44
 
Please login to merge, or discard this patch.