Passed
Push — trunk ( 338765...433e05 )
by SuperNova.WS
04:23
created
classes/HelperArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
    * @return array
241 241
    */
242 242
   public static function parseParamStrings($array, $delimiter = '=') {
243
-    !is_array($array) ? $array = array((string)$array) : false;
243
+    !is_array($array) ? $array = array((string) $array) : false;
244 244
 
245 245
     $result = array();
246 246
     foreach ($array as $param) {
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
    * @return float|null
263 263
    */
264 264
   public static function maxValueByField(&$array, $fieldName) {
265
-    return array_reduce($array, function ($carry, $item) use ($fieldName) {
266
-      if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
265
+    return array_reduce($array, function($carry, $item) use ($fieldName) {
266
+      if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
267 267
         $carry = $item[$fieldName];
268 268
       }
269 269
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
     return
282 282
       array_reduce($array,
283
-        function ($carry, $item) use (&$fieldName, $maxValue) {
284
-          if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
283
+        function($carry, $item) use (&$fieldName, $maxValue) {
284
+          if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
285 285
             $carry[] = $item;
286 286
           }
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
   }
293 293
 
294 294
   public static function intersectByKeys(array &$array1, array &$array2) {
295
-    return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;});
295
+    return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; });
296 296
   }
297 297
 
298 298
 }
Please login to merge, or discard this patch.
classes/DBAL/Schema.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 
53 53
     $prefix_length = strlen($this->db->db_prefix);
54 54
 
55
-    while($row = $this->db->db_fetch($query)) {
56
-      foreach($row as $table_name) {
55
+    while ($row = $this->db->db_fetch($query)) {
56
+      foreach ($row as $table_name) {
57 57
         $this->tablesAll[$table_name] = $table_name;
58 58
 
59
-        if(strpos($table_name, $this->db->db_prefix) === 0) {
59
+        if (strpos($table_name, $this->db->db_prefix) === 0) {
60 60
           $table_name_sn = substr($table_name, $prefix_length);
61 61
           $this->tablesSn[$table_name_sn] = $table_name_sn;
62 62
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
    * @return \string[]
71 71
    */
72 72
   public function getAllTables() {
73
-    if(!isset($this->tablesAll)) {
73
+    if (!isset($this->tablesAll)) {
74 74
       $this->loadTableNamesFromDb();
75 75
     }
76 76
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
    * @return string[]
84 84
    */
85 85
   public function getSnTables() {
86
-    if(!isset($this->tablesSn)) {
86
+    if (!isset($this->tablesSn)) {
87 87
       $this->loadTableNamesFromDb();
88 88
     }
89 89
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
    * @return TableSchema
108 108
    */
109 109
   public function getTableSchema($tableName) {
110
-    if(empty($this->tableSchemas[$tableName])) {
110
+    if (empty($this->tableSchemas[$tableName])) {
111 111
       $this->tableSchemas[$tableName] = new TableSchema($tableName, $this);
112 112
     }
113 113
 
Please login to merge, or discard this patch.
classes/Core/Repository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 
87 87
   public function get($entityClass, $id) {
88 88
     $entityIndex = get_class($entityClass) . '\\' . $id;
89
-    if(!isset($this->_repository[$entityIndex])) {
89
+    if (!isset($this->_repository[$entityIndex])) {
90 90
 
91 91
     }
92 92
 
Please login to merge, or discard this patch.
classes/classPersistent.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     $this->sql_index_field = "{$table_name}_name";
34 34
     $this->sql_value_field = "{$table_name}_value";
35 35
 
36
-    if(!$this->_DB_LOADED) {
36
+    if (!$this->_DB_LOADED) {
37 37
       $this->db_loadAll();
38 38
     }
39 39
   }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
    */
54 54
   public function db_loadItem($index) {
55 55
     $result = null;
56
-    if($index) {
56
+    if ($index) {
57 57
       $index_safe = db_escape($index);
58 58
       $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true);
59
-      if(is_array($queryResult) && !empty($queryResult)) {
59
+      if (is_array($queryResult) && !empty($queryResult)) {
60 60
         $this->$index = $result = $queryResult[$this->sql_value_field];
61 61
       }
62 62
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     $this->loadDefaults();
69 69
 
70 70
     $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;");
71
-    while($row = db_fetch($query)) {
71
+    while ($row = db_fetch($query)) {
72 72
       $this->$row[$this->sql_index_field] = $row[$this->sql_value_field];
73 73
     }
74 74
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
   }
77 77
 
78 78
   public function loadDefaults() {
79
-    foreach($this->defaults as $defName => $defValue) {
79
+    foreach ($this->defaults as $defName => $defValue) {
80 80
       $this->$defName = $defValue;
81 81
     }
82 82
   }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
   }
93 93
 
94 94
   public function db_saveItem($item_list, $value = NULL) {
95
-    if(empty($item_list)) {
95
+    if (empty($item_list)) {
96 96
       return;
97 97
     }
98 98
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 
101 101
     // Сначала записываем данные в базу - что бы поймать все блокировки
102 102
     $qry = array();
103
-    foreach($item_list as $item_name => $item_value) {
104
-      if($item_name) {
103
+    foreach ($item_list as $item_name => $item_value) {
104
+      if ($item_name) {
105 105
         $item_value = db_escape($item_value === NULL ? $this->$item_name : $item_value);
106 106
         $item_name = db_escape($item_name);
107 107
         $qry[] = "('{$item_name}', '{$item_value}')";
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
     doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
111 111
 
112 112
     // И только после взятия блокировок - меняем значения в кэше
113
-    foreach($item_list as $item_name => $item_value) {
114
-      if($item_name && $item_value !== null) {
113
+    foreach ($item_list as $item_name => $item_value) {
114
+      if ($item_name && $item_value !== null) {
115 115
         $this->__set($item_name, $item_value);
116 116
       }
117 117
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   }
127 127
 
128 128
   public function __get($name) {
129
-    if($this->force) {
129
+    if ($this->force) {
130 130
       $this->force = false;
131 131
       $this->db_loadItem($name);
132 132
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
   }
136 136
 
137 137
   public function __set($name, $value) {
138
-    if($this->force) {
138
+    if ($this->force) {
139 139
       $this->force = false;
140 140
       $this->db_saveItem($name, $value);
141 141
     }
Please login to merge, or discard this patch.
classes/StatUpdateLauncher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
         $config->pass()->game_disable = GAME_DISABLE_STAT;
59 59
 
60 60
         $statMinimalInterval = intval($config->pass()->stats_minimal_interval);
61
-        $config->pass()->var_stat_update_end= date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM));
61
+        $config->pass()->var_stat_update_end = date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM));
62 62
         $config->pass()->var_stat_update_msg = 'Update started';
63 63
         sn_db_transaction_commit();
64 64
 
Please login to merge, or discard this patch.
scheduler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@
 block discarded – undo
22 22
 
23 23
 define('IN_AJAX', true);
24 24
 
25
-if(($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) {
25
+if (($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) {
26 26
   $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8');
27 27
   print(json_encode($result));
28 28
 }
29 29
 
30
-if(!defined('IN_ADMIN')) {
30
+if (!defined('IN_ADMIN')) {
31 31
   die();
32 32
 }
Please login to merge, or discard this patch.
fleet.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 $planet = sys_get_param_int('planet', $planetrow['planet']);
40 40
 
41 41
 $target_mission = sys_get_param_int('target_mission');
42
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
42
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
43 43
   $planet_type = PT_PLANET;
44
-} elseif($target_mission == MT_RECYCLE) {
44
+} elseif ($target_mission == MT_RECYCLE) {
45 45
   $planet_type = PT_DEBRIS;
46
-} elseif($target_mission == MT_DESTROY) {
46
+} elseif ($target_mission == MT_DESTROY) {
47 47
   $planet_type = PT_MOON;
48 48
 } else {
49 49
   $planet_type = sys_get_param_int('planet_type');
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true);
60 60
 //$FlyingFleets = $FlyingFleets['Number'];
61 61
 $FlyingFleets = fleet_count_flying($user['id']);
62
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
62
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
63 63
   messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
64 64
 }
65 65
 
66 66
 $MaxExpeditions = get_player_max_expeditons($user);
67
-if($MaxExpeditions) {
67
+if ($MaxExpeditions) {
68 68
 //  $FlyingExpeditions  = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
69 69
 //  $FlyingExpeditions  = $FlyingExpeditions['expedi'];
70
-  $FlyingExpeditions  = fleet_count_flying($user['id'], MT_EXPLORE);
70
+  $FlyingExpeditions = fleet_count_flying($user['id'], MT_EXPLORE);
71 71
 } else {
72 72
   $FlyingExpeditions = 0;
73 73
 }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
     $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
81 81
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
82 82
 
83
-    foreach($fleetarray as $ship_id => &$ship_amount) {
84
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
83
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
84
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
85 85
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
86 86
         die();
87 87
       }
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
           $target_mission = MT_COLONIZE;
113 113
           $planet_type = PT_PLANET;
114 114
         } else {
115
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
115
+          messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
116 116
         }
117 117
       } else {
118 118
         $recyclers = 0;
119
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
119
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
120 120
           $recyclers += $fleetarray[$recycler_id];
121 121
         }
122 122
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
143 143
 
144
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
144
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
145 145
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
146 146
                 }
147 147
               }
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 );
202 202
 
203 203
 $is_transport_missions = false;
204
-if($missiontype) {
204
+if ($missiontype) {
205 205
   $sn_group_missions = sn_get_groups('missions');
206
-  foreach($missiontype as $mission_data_id => $mission_data) {
206
+  foreach ($missiontype as $mission_data_id => $mission_data) {
207 207
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
208 208
   }
209 209
 }
210 210
 
211
-switch($fleet_page) {
211
+switch ($fleet_page) {
212 212
   case 1:
213 213
     require('includes/includes/flt_page1.inc');
214 214
   break;
Please login to merge, or discard this patch.
classes/Meta/Economic/EconomicHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@
 block discarded – undo
75 75
    * @return float[] - [int resourceId] -> [float ratesNormalizedToResourceCost]
76 76
    */
77 77
   public function getResourceExchangeIn($resourceId) {
78
-    if(empty($this->resourceExchangeRates[$resourceId])) {
78
+    if (empty($this->resourceExchangeRates[$resourceId])) {
79 79
       $defaultRates = $this->getResourcesExchange();
80 80
 
81 81
       $this->resourceExchangeRates[$resourceId] = [];
82
-      foreach($defaultRates as $defaultResourceId => $defaultRate) {
82
+      foreach ($defaultRates as $defaultResourceId => $defaultRate) {
83 83
         $this->resourceExchangeRates[$resourceId][$defaultResourceId] = $defaultRate / $defaultRates[$resourceId];
84 84
       }
85 85
     }
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));}
3
+function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); }
4 4
 function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
5 5
 {
6 6
   global $lang;
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   return $mode;
20 20
 }
21 21
 
22
-function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));}
22
+function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); }
23 23
 /**
24 24
  * @param template $template
25 25
  * @param $edit_planet_row
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
   global $lang;
31 31
 
32 32
   $unit_list = sn_get_groups($mode);
33
-  if(empty($unit_list))
33
+  if (empty($unit_list))
34 34
   {
35 35
     return;
36 36
   }
37 37
   $name_list = $lang['tech'];
38 38
 
39
-  foreach($unit_list as $unit_id)
39
+  foreach ($unit_list as $unit_id)
40 40
   {
41 41
     $template->assign_block_vars('unit', array(
42 42
       'ID'    => $unit_id,
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
   }
48 48
 }
49 49
 
50
-function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));}
50
+function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); }
51 51
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode)
52 52
 {
53
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode)))
53
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode)))
54 54
   {
55 55
     $unit_amount = round($unit_amount);
56 56
     $unit_name = get_unit_param($unit_id, P_NAME);
Please login to merge, or discard this patch.