Completed
Push — work-fleets ( 4ec5b3...fe2ede )
by SuperNova.WS
10:06
created
classes/Buddy/BuddyParams.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,6 @@
 block discarded – undo
26 26
   /**
27 27
    * BuddyParams constructor.
28 28
    *
29
-   * @param array $user
30 29
    */
31 30
   public function __construct(array $values = array()) {
32 31
     parent::__construct($values);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @property string           $playerName
22 22
  * @property string           $playerNameAndCoordinates
23 23
  */
24
-class BuddyParams extends ContainerPlus  {
24
+class BuddyParams extends ContainerPlus {
25 25
 
26 26
   /**
27 27
    * BuddyParams constructor.
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
 //    $this->playerArray = $user;
41 41
 
42
-    $this->playerId = function (BuddyParams $cBuddy) {
42
+    $this->playerId = function(BuddyParams $cBuddy) {
43 43
       return $cBuddy->playerArray['id'];
44 44
     };
45
-    $this->playerName = function (BuddyParams $cBuddy) {
45
+    $this->playerName = function(BuddyParams $cBuddy) {
46 46
       return $cBuddy->playerArray['username'];
47 47
     };
48
-    $this->playerNameAndCoordinates = function (BuddyParams $cBuddy) {
49
-      return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray);
48
+    $this->playerNameAndCoordinates = function(BuddyParams $cBuddy) {
49
+      return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray);
50 50
     };
51 51
   }
52 52
 
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/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/Common/Accessors.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     if (is_callable($callable)) {
41 41
       $this->accessors[$varName][$accessor] = $callable;
42 42
     } else {
43
-      throw new \Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $accessor . '] is not a callable or not accessible in the scope');
43
+      throw new \Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$accessor.'] is not a callable or not accessible in the scope');
44 44
     }
45 45
   }
46 46
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
    */
77 77
   public function invokeAccessor($varName, $accessor, $params) {
78 78
     if (!$this->haveAccessor($varName, $accessor)) {
79
-      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on " . get_called_class() . "::" . __METHOD__);
79
+      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on ".get_called_class()."::".__METHOD__);
80 80
     }
81 81
 
82 82
     return call_user_func_array($this->getAccessor($varName, $accessor), $params);
Please login to merge, or discard this patch.
classes/Common/GlobalContainer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,59 +36,59 @@
 block discarded – undo
36 36
     $gc = $this;
37 37
 
38 38
     // Default db
39
-    $gc->db = function ($c) {
39
+    $gc->db = function($c) {
40 40
       classSupernova::$db = $db = new \db_mysql($c);
41 41
 
42 42
       return $db;
43 43
     };
44 44
 
45
-    $gc->debug = function ($c) {
45
+    $gc->debug = function($c) {
46 46
       return new \debug();
47 47
     };
48 48
 
49
-    $gc->types = function ($c) {
49
+    $gc->types = function($c) {
50 50
       return new \Common\Types();
51 51
     };
52 52
 
53
-    $gc->cache = function ($c) {
53
+    $gc->cache = function($c) {
54 54
       return new \classCache(classSupernova::$cache_prefix);
55 55
     };
56 56
 
57
-    $gc->config = function ($c) {
57
+    $gc->config = function($c) {
58 58
       return new \classConfig(classSupernova::$cache_prefix);
59 59
     };
60 60
 
61
-    $gc->localePlayer = function (GlobalContainer $c) {
61
+    $gc->localePlayer = function(GlobalContainer $c) {
62 62
       return new \classLocale($c->config->server_locale_log_usage);
63 63
     };
64 64
 
65
-    $gc->dbGlobalRowOperator = function (GlobalContainer $c) {
65
+    $gc->dbGlobalRowOperator = function(GlobalContainer $c) {
66 66
       return new \DbRowDirectOperator($c->db);
67 67
     };
68 68
 
69
-    $gc->query = $gc->factory(function (GlobalContainer $c) {
69
+    $gc->query = $gc->factory(function(GlobalContainer $c) {
70 70
       return new \DbQueryConstructor($c->db);
71 71
     });
72 72
 
73
-    $gc->cacheOperator = function (GlobalContainer $gc) {
73
+    $gc->cacheOperator = function(GlobalContainer $gc) {
74 74
       return new \SnDbCachedOperator($gc);
75 75
     };
76 76
 
77 77
     $gc->snCacheClass = 'SnCache';
78
-    $gc->snCache = function (GlobalContainer $gc) {
78
+    $gc->snCache = function(GlobalContainer $gc) {
79 79
       return $gc->db->snCache;
80 80
     };
81 81
 
82 82
     $gc->buddyClass = 'Buddy\BuddyModel';
83
-    $gc->buddyModel = function (GlobalContainer $c) {
83
+    $gc->buddyModel = function(GlobalContainer $c) {
84 84
       return new $c->buddyClass($c);
85 85
     };
86 86
 
87
-    $gc->unitModel = function (GlobalContainer $c) {
87
+    $gc->unitModel = function(GlobalContainer $c) {
88 88
       return new \V2Unit\V2UnitModel($c);
89 89
     };
90 90
 
91
-    $gc->fleetModel = function (GlobalContainer $c) {
91
+    $gc->fleetModel = function(GlobalContainer $c) {
92 92
       return new V2FleetModel($c);
93 93
     };
94 94
   }
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.
classes/Buddy/BuddyModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
  *
21 21
  * @package Buddy
22 22
  */
23
-class BuddyModel extends \Entity\KeyedModel{
23
+class BuddyModel extends \Entity\KeyedModel {
24 24
 
25 25
   /**
26 26
    * Name of table for this entity
Please login to merge, or discard this patch.
classes/PropertyHider.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 
80 80
   protected function checkPropertyExists($name) {
81 81
     if (!array_key_exists($name, $this->_properties)) {
82
-      throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR);
82
+      throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR);
83 83
     }
84 84
   }
85 85
 
86 86
   protected function checkOverwriteAdjusted($name) {
87 87
     if (array_key_exists($name, $this->propertiesAdjusted)) {
88
-      throw new ExceptionPropertyAccess('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR);
88
+      throw new ExceptionPropertyAccess('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR);
89 89
     }
90 90
   }
91 91
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
    * @return boolean
135 135
    */
136 136
   public function isContainerEmpty() {
137
-    throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class ' . get_called_class());
137
+    throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class '.get_called_class());
138 138
   }
139 139
 
140 140
 
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
     $result = null;
179 179
     // Now deciding - will we call a protected setter or will we work with protected property
180 180
     // Todo - on init recalc all method_exists
181
-    if (method_exists($this, $methodName = $action . ucfirst($name))) {
181
+    if (method_exists($this, $methodName = $action.ucfirst($name))) {
182 182
       // If method exists - just calling it
183 183
       // TODO - should return TRUE if value changed or FALSE otherwise
184 184
       $result = call_user_func_array(array($this, $methodName), array($value));
185 185
     } elseif ($this->isPropertyActionAvailable($name, $action)) {
186 186
       // No setter exists - works directly with protected property
187
-      $result = $this->{$action . 'Property'}($name, $value);
187
+      $result = $this->{$action.'Property'}($name, $value);
188 188
     } else {
189
-      throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR);
189
+      throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR);
190 190
     }
191 191
 
192 192
     return $result;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
    * @return string
278 278
    */
279 279
   protected function adjustPropertyString($name, $diff) {
280
-    return (string)$this->$name . (string)$diff;
280
+    return (string) $this->$name.(string) $diff;
281 281
   }
282 282
 
283 283
   /**
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
    * @return array
288 288
    */
289 289
   protected function adjustPropertyArray($name, $diff) {
290
-    $copy = (array)$this->$name;
291
-    HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP);
290
+    $copy = (array) $this->$name;
291
+    HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP);
292 292
 
293 293
     return $copy;
294 294
   }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
    * @return int
301 301
    */
302 302
   protected function deltaInteger($name, $diff) {
303
-    return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff;
303
+    return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff;
304 304
   }
305 305
 
306 306
   /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
    * @return float
311 311
    */
312 312
   protected function deltaDouble($name, $diff) {
313
-    return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff;
313
+    return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff;
314 314
   }
315 315
 
316 316
   /**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
    * @return string
321 321
    */
322 322
   protected function deltaString($name, $diff) {
323
-    return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff;
323
+    return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff;
324 324
   }
325 325
 
326 326
   /**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
    * @return array
331 331
    */
332 332
   protected function deltaArray($name, $diff) {
333
-    $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array());
333
+    $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array());
334 334
     HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP);
335 335
 
336 336
     return $copy;
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
     // Capitalizing type name
354 354
     $methodName = explode(' ', $type);
355 355
     array_walk($methodName, 'DbSqlHelper::UCFirstByRef');
356
-    $methodName = $prefix . implode('', $methodName);
356
+    $methodName = $prefix.implode('', $methodName);
357 357
 
358 358
     if (!method_exists($this, $methodName)) {
359
-      throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult');
359
+      throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult');
360 360
     }
361 361
 
362 362
     return call_user_func(array($this, $methodName), $name, $diff);
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Защита от двойного инита
4
-if(defined('INIT')) {
4
+if (defined('INIT')) {
5 5
   return;
6 6
 }
7 7
 
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 define('SN_DEBUG_PDUMP_CALLER', true);
20 20
 
21 21
 // Бенчмарк
22
-register_shutdown_function(function () {
23
-  if(defined('IN_AJAX')) {
22
+register_shutdown_function(function() {
23
+  if (defined('IN_AJAX')) {
24 24
     return;
25 25
   }
26 26
 
27 27
   global $user, $locale_cache_statistic;
28 28
 
29
-  print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) .
30
-    (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') .
31
-    (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') .
29
+  print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START).
30
+    (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '').
31
+    (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : '').
32 32
     '</div>');
33
-  if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
33
+  if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) {
34 34
     echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>';
35 35
   }
36 36
 
37
-  if(!empty($locale_cache_statistic['misses'])) {
37
+  if (!empty($locale_cache_statistic['misses'])) {
38 38
     print('<!--');
39 39
     pdump($locale_cache_statistic);
40 40
     print('-->');
@@ -54,46 +54,46 @@  discard block
 block discarded – undo
54 54
 
55 55
 define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW));
56 56
 
57
-if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
57
+if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
58 58
   define('SN_GOOGLE', true);
59 59
 }
60 60
 
61 61
 // Эти три строки должны быть В ЭТОМ ФАЙЛЕ, ПО ЭТОМУ ПУТИ и ПЕРЕД ЭТИМ ИНКЛЮДОМ!!!
62
-define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__) . '/'));
62
+define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__).'/'));
63 63
 define('SN_ROOT_PHYSICAL_STR_LEN', strlen(SN_ROOT_PHYSICAL));
64 64
 $phpbb_root_path = SN_ROOT_PHYSICAL; // Это нужно для работы PTL
65 65
 
66
-$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd() . '/');
66
+$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd().'/');
67 67
 //$sn_root_relative .= $sn_root_relative[strlen($sn_root_relative) - 1] == '/' ? '' : '/';
68 68
 $sn_root_relative = str_replace(SN_ROOT_PHYSICAL, '', $sn_root_relative);
69 69
 $sn_root_relative .= basename($_SERVER['SCRIPT_NAME']);
70 70
 $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']);
71 71
 define('SN_ROOT_RELATIVE', $sn_root_relative);
72 72
 
73
-define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE);
73
+define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE);
74 74
 define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL));
75 75
 
76 76
 $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : '';
77
-define('DOT_PHP_EX', '.' . $phpEx); // PHP extension on this server
77
+define('DOT_PHP_EX', '.'.$phpEx); // PHP extension on this server
78 78
 
79 79
 
80 80
 header('Content-type: text/html; charset=utf-8');
81 81
 ob_start();
82 82
 ini_set('error_reporting', E_ALL ^ E_NOTICE);
83 83
 
84
-empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false;
85
-spl_autoload_register(function ($class) use ($classRoot) {
84
+empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'classes/' : false;
85
+spl_autoload_register(function($class) use ($classRoot) {
86 86
   $class = str_replace('\\', '/', $class);
87
-  if (file_exists($classRoot . $class . '.php')) {
88
-    require_once $classRoot . $class . '.php';
89
-  } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) {
90
-    require_once $classRoot . 'UBE/' . $class . '.php';
87
+  if (file_exists($classRoot.$class.'.php')) {
88
+    require_once $classRoot.$class.'.php';
89
+  } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) {
90
+    require_once $classRoot.'UBE/'.$class.'.php';
91 91
   }
92 92
 });
93 93
 
94 94
 require_once 'constants.php';
95
-require_once SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX;
96
-require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX);
95
+require_once SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX;
96
+require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX);
97 97
 
98 98
 /**
99 99
  * @var classConfig    $config
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 // define('BE_DEBUG', true); // Отладка боевого движка
112 112
 classSupernova::init_debug_state();
113 113
 
114
-require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX);
115
-require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX);
114
+require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX);
115
+require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX);
116 116
 
117 117
 init_update();
118 118
 
@@ -121,28 +121,28 @@  discard block
 block discarded – undo
121 121
   ? trim(strip_tags($_GET['page']))
122 122
   : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME'])));
123 123
 define('INITIAL_PAGE', $sn_page_name_original);
124
-define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : ''));
125
-define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX);
126
-define('SN_COOKIE_D', SN_COOKIE . '_D');
127
-define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie
128
-define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie
129
-define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID
130
-define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
124
+define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : ''));
125
+define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX);
126
+define('SN_COOKIE_D', SN_COOKIE.'_D');
127
+define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie
128
+define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie
129
+define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID
130
+define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
131 131
 define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame');
132
-define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME);
133
-define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH);
132
+define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME);
133
+define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH);
134 134
 define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/');
135 135
 define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru');
136 136
 define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y');
137 137
 define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s');
138
-define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME);
138
+define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME);
139 139
 
140 140
 $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG;
141 141
 
142
-require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX);
142
+require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX);
143 143
 $template_result = array('.' => array('result' => array()));
144 144
 
145
-sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", DOT_PHP_EX);
145
+sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", DOT_PHP_EX);
146 146
 
147 147
 
148 148
 // Подключаем все модули
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 // Конфиг - часть манифеста?
153 153
 classSupernova::$auth = new core_auth();
154 154
 
155
-sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", DOT_PHP_EX, true);
155
+sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", DOT_PHP_EX, true);
156 156
 // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно
157 157
 
158 158
 // Подключаем дефолтную страницу
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда
161 161
 // Но нужно, пока у нас есть не MVC-страницы
162 162
 $sn_page_data = $sn_data['pages'][$sn_page_name];
163
-$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
164
-if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
163
+$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX;
164
+if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
165 165
   require_once($sn_page_name_file);
166
-  if(is_array($sn_page_data['options'])) {
166
+  if (is_array($sn_page_data['options'])) {
167 167
     classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']);
168 168
   }
169 169
 }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
176
-if(!isset($sn_data['pages'][$sn_page_name])) {
176
+if (!isset($sn_data['pages'][$sn_page_name])) {
177 177
   $sn_page_name = '';
178 178
 }
179 179
 
@@ -181,6 +181,6 @@  discard block
 block discarded – undo
181 181
 classLocale::$lang = $lang = classSupernova::$gc->localePlayer;
182 182
 classLocale::$lang->lng_switch(sys_get_param_str('lang'));
183 183
 
184
-if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
184
+if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
185 185
   require_once "init_secondary.php";
186 186
 }
Please login to merge, or discard this patch.