Completed
Push — work-fleets ( 1735a9...f6000a )
by SuperNova.WS
06:05
created
includes/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.
includes/classes/UBE/ArrayAccessV2.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
   public function __clone() {
45
-    if(static::$_clonable == ArrayAccessV2::CLONE_NONE) {
45
+    if (static::$_clonable == ArrayAccessV2::CLONE_NONE) {
46 46
       return;
47 47
     }
48 48
 
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
   }
51 51
 
52 52
   protected static function _deep_clone(&$array) {
53
-    foreach($array as &$value) {
54
-      if(is_object($value)) {
53
+    foreach ($array as &$value) {
54
+      if (is_object($value)) {
55 55
         $value = clone $value;
56
-      } elseif(is_array($value) && static::$_clonable == ArrayAccessV2::CLONE_DEEP) {
56
+      } elseif (is_array($value) && static::$_clonable == ArrayAccessV2::CLONE_DEEP) {
57 57
         static::_deep_clone($value);
58 58
       }
59 59
     }
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
    */
68 68
   public function __call($method_name, array $arguments) {
69 69
     $object_first = reset($this->_container);
70
-    if($object_first !== false && method_exists($object_first, $method_name)) {
71
-      foreach($this->_container as $unit_id => $object) {
70
+    if ($object_first !== false && method_exists($object_first, $method_name)) {
71
+      foreach ($this->_container as $unit_id => $object) {
72 72
         call_user_func_array(array($object, $method_name), $arguments);
73 73
       }
74 74
     }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
    */
84 84
   public function getSumProperty($property_name) {
85 85
     $result = 0.0;
86
-    foreach($this->_container as $object) {
87
-      if(is_object($object) && property_exists($object, $property_name)) {
86
+    foreach ($this->_container as $object) {
87
+      if (is_object($object) && property_exists($object, $property_name)) {
88 88
         $result += $object->$property_name;
89 89
       }
90 90
     }
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
    * @return mixed
101 101
    */
102 102
   public function aggregateByMethod($method_name, &$result) {
103
-    foreach($this->_container as $object) {
104
-      if(is_object($object) && method_exists($object, $method_name)) {
103
+    foreach ($this->_container as $object) {
104
+      if (is_object($object) && method_exists($object, $method_name)) {
105 105
         call_user_func(array($object, $method_name), $result);
106 106
       }
107 107
     }
Please login to merge, or discard this patch.
includes/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.
includes/classes/Unit.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
    * @param string $group_name
155 155
    */
156 156
   public static function _init($group_name = '') {
157
-    if(static::$_is_static_init) {
157
+    if (static::$_is_static_init) {
158 158
       return;
159 159
     }
160 160
 
161
-    if($group_name) {
161
+    if ($group_name) {
162 162
       static::$_sn_group_name = $group_name;
163 163
     }
164 164
 
165
-    if(static::$_sn_group_name) {
165
+    if (static::$_sn_group_name) {
166 166
       static::$_group_unit_id_list = sn_get_groups(static::$_sn_group_name);
167 167
       empty(static::$_group_unit_id_list) ? static::$_group_unit_id_list = array() : false;
168 168
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     // TODO - Reset combat stats??
188 188
     $this->_unitId = $unitId;
189 189
 
190
-    if($this->_unitId) {
190
+    if ($this->_unitId) {
191 191
       $this->info = get_unit_param($this->_unitId);
192 192
       $this->_type = $this->info[P_UNIT_TYPE];
193 193
     } else {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
   protected function setCount($value) {
200 200
     // TODO - Reset combat stats??
201
-    if($value < 0) {
201
+    if ($value < 0) {
202 202
       classSupernova::$debug->error('Can not set Unit::$count to negative value');
203 203
     }
204 204
     $this->_count = $value;
Please login to merge, or discard this patch.
includes/classes/DBRow.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -411,7 +411,7 @@
 block discarded – undo
411 411
   /**
412 412
    * @param array $field_set
413 413
    *
414
-   * @return int|string
414
+   * @return integer
415 415
    */
416 416
   protected function db_field_set_create(array $field_set) {
417 417
     !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set) : false;
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
    */
109 109
   public function __get($name) {
110 110
     // Redirecting inaccessible get to __call which will handle the rest
111
-    return $this->__call('get' . ucfirst($name), array());
111
+    return $this->__call('get'.ucfirst($name), array());
112 112
   }
113 113
 
114 114
   /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
   // TODO - сеттер должен параллельно изменять значение db_row - for now...
121 121
   public function __set($name, $value) {
122 122
     // Redirecting inaccessible set to __call which will handle the rest
123
-    $this->__call('set' . ucfirst($name), array($value));
123
+    $this->__call('set'.ucfirst($name), array($value));
124 124
   }
125 125
 
126 126
   /**
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 
139 139
     // If method is not getter or setter OR property name not exists in $_properties - raising exception
140 140
     // Descendants can catch this Exception to make own __call magic
141
-    if(($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) {
142
-      throw new ExceptionPropertyNotExists('Property ' . $propertyName . ' not exists when calling getter/setter ' . get_called_class() . '::' . $name, ERR_ERROR);
141
+    if (($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) {
142
+      throw new ExceptionPropertyNotExists('Property '.$propertyName.' not exists when calling getter/setter '.get_called_class().'::'.$name, ERR_ERROR);
143 143
     }
144 144
 
145 145
     // TODO check for read-only
146 146
 
147
-    if($left3 == 'set') {
148
-      if(!empty($this->propertiesAdjusted[$propertyName])) {
149
-        throw new PropertyAccessException('Property ' . $propertyName . ' already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::' . $name, ERR_ERROR);
147
+    if ($left3 == 'set') {
148
+      if (!empty($this->propertiesAdjusted[$propertyName])) {
149
+        throw new PropertyAccessException('Property '.$propertyName.' already was adjusted so no SET is possible until dbSave in '.get_called_class().'::'.$name, ERR_ERROR);
150 150
       }
151 151
       $this->propertiesChanged[$propertyName] = 1;
152 152
     }
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
     // Now deciding - will we call a protected setter or will we work with protected property
155 155
 
156 156
     // If method exists - just calling it
157
-    if(method_exists($this, $name)) {
157
+    if (method_exists($this, $name)) {
158 158
       return call_user_func_array(array($this, $name), $arguments);
159 159
     }
160 160
     // No getter/setter exists - works directly with protected property
161 161
 
162 162
     // Is it getter?
163
-    if($left3 === 'get') {
164
-      return $this->{'_' . $propertyName};
163
+    if ($left3 === 'get') {
164
+      return $this->{'_'.$propertyName};
165 165
     }
166 166
 
167 167
     // Not getter? Then it's setter
168
-    $this->{'_' . $propertyName} = $arguments[0];
168
+    $this->{'_'.$propertyName} = $arguments[0];
169 169
 
170 170
     return null;
171 171
   }
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
    */
183 183
   public function dbLoad($dbId, $lockSkip = false) {
184 184
     $dbId = idval($dbId);
185
-    if($dbId <= 0) {
186
-      classSupernova::$debug->error(get_called_class() . '::dbLoad $dbId not positive = ' . $dbId);
185
+    if ($dbId <= 0) {
186
+      classSupernova::$debug->error(get_called_class().'::dbLoad $dbId not positive = '.$dbId);
187 187
 
188 188
       return;
189 189
     }
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
     $this->_dbId = $dbId;
192 192
     $this->lockSkip = $lockSkip;
193 193
     // TODO - Use classSupernova::$db_records_locked
194
-    if(false && !$lockSkip && sn_db_transaction_check(false)) {
194
+    if (false && !$lockSkip && sn_db_transaction_check(false)) {
195 195
       $this->dbGetLockById($this->_dbId);
196 196
     }
197 197
 
198
-    $db_row = doquery("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;", true);
199
-    if(empty($db_row)) {
198
+    $db_row = doquery("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;", true);
199
+    if (empty($db_row)) {
200 200
       return;
201 201
     }
202 202
 
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
    */
225 225
   // TODO - perform operations only if properties was changed
226 226
   public function dbSave() {
227
-    if($this->isNew()) {
227
+    if ($this->isNew()) {
228 228
       // No DB_ID - new unit
229
-      if($this->isEmpty()) {
230
-        classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave');
229
+      if ($this->isEmpty()) {
230
+        classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave');
231 231
       }
232 232
       $this->dbInsert();
233 233
     } else {
234 234
       // DB_ID is present
235
-      if($this->isEmpty()) {
235
+      if ($this->isEmpty()) {
236 236
         $this->dbDelete();
237 237
       } else {
238
-        if(!sn_db_transaction_check(false)) {
239
-          classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate');
238
+        if (!sn_db_transaction_check(false)) {
239
+          classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate');
240 240
         }
241 241
         $this->dbUpdate();
242 242
       }
243 243
     }
244 244
 
245
-    if(!empty($this->triggerDbOperationOn)) {
246
-      foreach($this->triggerDbOperationOn as $item) {
245
+    if (!empty($this->triggerDbOperationOn)) {
246
+      foreach ($this->triggerDbOperationOn as $item) {
247 247
         $item->dbSave();
248 248
       }
249 249
     }
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
    */
264 264
   // TODO - protected
265 265
   public function dbInsert() {
266
-    if(!$this->isNew()) {
267
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert');
266
+    if (!$this->isNew()) {
267
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert');
268 268
     }
269 269
     $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet());
270 270
 
271
-    if(empty($this->_dbId)) {
272
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
271
+    if (empty($this->_dbId)) {
272
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert');
273 273
     }
274 274
 
275 275
     return $this->_dbId;
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
   // TODO - protected
282 282
   public function dbUpdate() {
283 283
     // TODO - Update
284
-    if($this->isNew()) {
285
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
284
+    if ($this->isNew()) {
285
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate');
286 286
     }
287 287
     $this->db_field_update($this->dbMakeFieldSet(true));
288 288
   }
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
    */
293 293
   // TODO - protected
294 294
   public function dbDelete() {
295
-    if($this->isNew()) {
296
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
295
+    if ($this->isNew()) {
296
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete');
297 297
     }
298
-    doquery("DELETE FROM {{" . static::$_table . "}} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
298
+    doquery("DELETE FROM {{".static::$_table."}} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId);
299 299
     $this->_dbId = 0;
300 300
     // Обо всём остальном должен позаботиться контейнер
301 301
   }
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
    * @param array $db_row
335 335
    */
336 336
   public function dbRowParse(array $db_row) {
337
-    foreach(static::$_properties as $property_name => &$property_data) {
337
+    foreach (static::$_properties as $property_name => &$property_data) {
338 338
       // Advanced values extraction procedure. Should be used when at least one of following rules is matched:
339 339
       // - one field should translate to several properties;
340 340
       // - one property should be filled according to several fields;
341 341
       // - property filling requires some lookup in object values;
342
-      if(!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) {
342
+      if (!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) {
343 343
         call_user_func_array(array($this, $property_data[P_METHOD_EXTRACT]), array(&$db_row));
344 344
         continue;
345 345
       }
346 346
 
347 347
       // If property is read-only - doing nothing
348
-      if(!empty($property_data[P_READ_ONLY])) {
348
+      if (!empty($property_data[P_READ_ONLY])) {
349 349
         continue;
350 350
       }
351 351
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
       !empty($property_data[P_FUNC_INPUT]) && is_callable($property_data[P_FUNC_INPUT]) ? $value = call_user_func($property_data[P_FUNC_INPUT], $value) : false;
357 357
 
358 358
       // If there is setter for this field - using it. Setters is always a methods of $THIS
359
-      if(!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) {
359
+      if (!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) {
360 360
         call_user_func(array($this, $property_data[P_METHOD_SET]), $value);
361 361
       } else {
362 362
         $this->{$property_name} = $value;
@@ -372,21 +372,21 @@  discard block
 block discarded – undo
372 372
   protected function dbMakeFieldSet($isUpdate = false) {
373 373
     $array = array();
374 374
 
375
-    foreach(static::$_properties as $property_name => &$property_data) {
375
+    foreach (static::$_properties as $property_name => &$property_data) {
376 376
       // TODO - on isUpdate add only changed/adjusted properties
377 377
 
378
-      if(!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) {
378
+      if (!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) {
379 379
         call_user_func_array(array($this, $property_data[P_METHOD_INJECT]), array(&$array));
380 380
         continue;
381 381
       }
382 382
 
383 383
       // Skipping properties which have no corresponding field in DB
384
-      if(empty($property_data[P_DB_FIELD])) {
384
+      if (empty($property_data[P_DB_FIELD])) {
385 385
         continue;
386 386
       }
387 387
 
388 388
       // Checking - is property was adjusted or changed
389
-      if($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) {
389
+      if ($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) {
390 390
         // For adjusted property - take value from propertiesAdjusted array
391 391
         // TODO - differ how treated conversion to string for changed and adjusted properties
392 392
         $value = $this->propertiesAdjusted[$property_name];
@@ -416,17 +416,17 @@  discard block
 block discarded – undo
416 416
    */
417 417
   protected function isFieldChanged($fieldName) {
418 418
     $isFieldChanged = false;
419
-    foreach($this->propertiesChanged as $propertyName => $cork) {
419
+    foreach ($this->propertiesChanged as $propertyName => $cork) {
420 420
       $propertyScheme = static::$_properties[$propertyName];
421
-      if(!empty($propertyScheme[P_DB_FIELDS_LINKED])) {
422
-        foreach($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) {
423
-          if($linkedFieldName == $fieldName) {
421
+      if (!empty($propertyScheme[P_DB_FIELDS_LINKED])) {
422
+        foreach ($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) {
423
+          if ($linkedFieldName == $fieldName) {
424 424
             $isFieldChanged = $propertyName;
425 425
             break 2;
426 426
           }
427 427
         }
428 428
       }
429
-      if(!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) {
429
+      if (!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) {
430 430
         $isFieldChanged = $propertyName;
431 431
         break;
432 432
       }
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     $fields = implode(',', array_keys($field_set));
449 449
 
450 450
     $result = 0;
451
-    if(classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) {
451
+    if (classSupernova::db_query("INSERT INTO `{{".static::$_table."}}` ({$fields}) VALUES ({$values});")) {
452 452
       $result = db_insert_id();
453 453
     }
454 454
 
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
     sn_db_field_set_safe_flag_clear($field_set);
467 467
 
468 468
     $set = array();
469
-    foreach($field_set as $fieldName => $value) {
470
-      if(!($changedProperty = $this->isFieldChanged($fieldName))) {
469
+    foreach ($field_set as $fieldName => $value) {
470
+      if (!($changedProperty = $this->isFieldChanged($fieldName))) {
471 471
         continue;
472 472
       }
473 473
 
474 474
       // TODO - separate sets from adjusts
475
-      if(array_key_exists($changedProperty, $this->propertiesAdjusted)) {
475
+      if (array_key_exists($changedProperty, $this->propertiesAdjusted)) {
476 476
         $value = "`{$fieldName}` + ($value)"; // braces for negative values
477 477
       }
478 478
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 
485 485
     return empty($set_string)
486 486
       ? true
487
-      : classSupernova::db_query("UPDATE `{{" . static::$_table . "}}` SET {$set_string} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
487
+      : classSupernova::db_query("UPDATE `{{".static::$_table."}}` SET {$set_string} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId);
488 488
   }
489 489
 
490 490
 }
Please login to merge, or discard this patch.
includes/classes/UBE/UBEFleet.php 2 patches
Doc Comments   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
   }
151 151
 
152 152
   /**
153
-   * @param $ube_report_id
153
+   * @param integer $ube_report_id
154 154
    *
155 155
    * @return array
156 156
    *
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 
290 290
   /**
291
-   * @param $ube_report_id
291
+   * @param integer $ube_report_id
292 292
    *
293 293
    * @return array
294 294
    */
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
   // Рендерит таблицу общего результата боя
337 337
   /**
338 338
    * @param $array
339
-   * @param $lang_header_index
339
+   * @param string $lang_header_index
340 340
    *
341 341
    * @return array
342 342
    */
@@ -362,6 +362,9 @@  discard block
 block discarded – undo
362 362
   }
363 363
 
364 364
 
365
+  /**
366
+   * @param integer $ube_report_id
367
+   */
365 368
   public function sql_generate_outcome_unit_array(&$sql_perform_report_unit, $ube_report_id) {
366 369
     $fleet_id = $this->db_id;
367 370
 
@@ -468,6 +471,10 @@  discard block
 block discarded – undo
468 471
     $this->fleet_capacity -= $fleet_total_resources;
469 472
   }
470 473
 
474
+  /**
475
+   * @param integer $is_small_fleet_recce
476
+   * @param integer $reapers_status
477
+   */
471 478
   public function db_save_combat_result_fleet($is_small_fleet_recce, $reapers_status) {
472 479
     $ship_count_initial = $this->unit_list->unitsCount();
473 480
     $ship_count_lost = $this->unit_list->unitCountLost();
@@ -535,7 +542,7 @@  discard block
 block discarded – undo
535 542
 
536 543
   /**
537 544
    * @param UBEFleetList $fleet_list
538
-   * @param              $is_simulator
545
+   * @param              boolean $is_simulator
539 546
    *
540 547
    * @version 2016-02-25 23:42:45 41a4.68
541 548
    */
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
       $this->owner_id,
163 163
       $this->db_id,
164 164
 
165
-      (float)$this->UBE_PLANET[PLANET_ID],
166
-      "'" . db_escape($this->UBE_PLANET[PLANET_NAME]) . "'",
167
-      (int)$this->UBE_PLANET[PLANET_GALAXY],
168
-      (int)$this->UBE_PLANET[PLANET_SYSTEM],
169
-      (int)$this->UBE_PLANET[PLANET_PLANET],
170
-      (int)$this->UBE_PLANET[PLANET_TYPE],
171
-
172
-      (float)$this->resource_list[RES_METAL],
173
-      (float)$this->resource_list[RES_CRYSTAL],
174
-      (float)$this->resource_list[RES_DEUTERIUM],
175
-
176
-      (float)$this->fleet_bonus->calcBonus(P_ATTACK),
177
-      (float)$this->fleet_bonus->calcBonus(P_SHIELD),
178
-      (float)$this->fleet_bonus->calcBonus(P_ARMOR),
165
+      (float) $this->UBE_PLANET[PLANET_ID],
166
+      "'".db_escape($this->UBE_PLANET[PLANET_NAME])."'",
167
+      (int) $this->UBE_PLANET[PLANET_GALAXY],
168
+      (int) $this->UBE_PLANET[PLANET_SYSTEM],
169
+      (int) $this->UBE_PLANET[PLANET_PLANET],
170
+      (int) $this->UBE_PLANET[PLANET_TYPE],
171
+
172
+      (float) $this->resource_list[RES_METAL],
173
+      (float) $this->resource_list[RES_CRYSTAL],
174
+      (float) $this->resource_list[RES_DEUTERIUM],
175
+
176
+      (float) $this->fleet_bonus->calcBonus(P_ATTACK),
177
+      (float) $this->fleet_bonus->calcBonus(P_SHIELD),
178
+      (float) $this->fleet_bonus->calcBonus(P_ARMOR),
179 179
     );
180 180
   }
181 181
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
     $this->group_id = $objFleet->group_id;
191 191
 
192 192
     $fleet_unit_list = $objFleet->shipsGetArray();
193
-    foreach($fleet_unit_list as $unit_id => $unit_count) {
194
-      if(!$unit_count) {
193
+    foreach ($fleet_unit_list as $unit_id => $unit_count) {
194
+      if (!$unit_count) {
195 195
         continue;
196 196
       }
197 197
 
198 198
       $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
199
-      if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
199
+      if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
200 200
         $this->unit_list->unitAdjustCount($unit_id, $unit_count);
201 201
       }
202 202
     }
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 //      }
233 233
 //    }
234 234
 
235
-    foreach($sn_group_combat as $unit_id) {
236
-      if($unit_count = mrc_get_level($player_db_row, $planet_row, $unit_id)) {
235
+    foreach ($sn_group_combat as $unit_id) {
236
+      if ($unit_count = mrc_get_level($player_db_row, $planet_row, $unit_id)) {
237 237
         $this->unit_list->unitAdjustCount($unit_id, $unit_count);
238 238
       }
239 239
     }
240 240
 
241
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
241
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
242 242
       $this->resource_list[$resource_id] = floor(mrc_get_level($player_db_row, $planet_row, $resource_id));
243 243
     }
244 244
 
@@ -297,27 +297,27 @@  discard block
 block discarded – undo
297 297
       $ube_report_id,
298 298
       $this->db_id,
299 299
 
300
-      (float)$this->resources_lost_on_units[RES_METAL],
301
-      (float)$this->resources_lost_on_units[RES_CRYSTAL],
302
-      (float)$this->resources_lost_on_units[RES_DEUTERIUM],
303
-      (float)$this->cargo_dropped[RES_METAL],
304
-      (float)$this->cargo_dropped[RES_CRYSTAL],
305
-      (float)$this->cargo_dropped[RES_DEUTERIUM],
306
-      (float)$this->resources_looted[RES_METAL],
307
-      (float)$this->resources_looted[RES_CRYSTAL],
308
-      (float)$this->resources_looted[RES_DEUTERIUM],
309
-      (float)$this->resources_lost_in_metal[RES_METAL],
300
+      (float) $this->resources_lost_on_units[RES_METAL],
301
+      (float) $this->resources_lost_on_units[RES_CRYSTAL],
302
+      (float) $this->resources_lost_on_units[RES_DEUTERIUM],
303
+      (float) $this->cargo_dropped[RES_METAL],
304
+      (float) $this->cargo_dropped[RES_CRYSTAL],
305
+      (float) $this->cargo_dropped[RES_DEUTERIUM],
306
+      (float) $this->resources_looted[RES_METAL],
307
+      (float) $this->resources_looted[RES_CRYSTAL],
308
+      (float) $this->resources_looted[RES_DEUTERIUM],
309
+      (float) $this->resources_lost_in_metal[RES_METAL],
310 310
     );
311 311
   }
312 312
 
313 313
   public function report_render_outcome_side_fleet() {
314 314
     $UBE_DEFENCE_RESTORE = array();
315 315
     $UBE_UNITS_LOST = array();
316
-    foreach($this->unit_list->_container as $UBEUnit) {
317
-      if($UBEUnit->units_restored) {
316
+    foreach ($this->unit_list->_container as $UBEUnit) {
317
+      if ($UBEUnit->units_restored) {
318 318
         $UBE_DEFENCE_RESTORE[$UBEUnit->unitId] = $UBEUnit->units_restored;
319 319
       }
320
-      if($UBEUnit->units_lost) {
320
+      if ($UBEUnit->units_lost) {
321 321
         $UBE_UNITS_LOST[$UBEUnit->unitId] = $UBEUnit->units_lost;
322 322
       }
323 323
     }
@@ -342,16 +342,16 @@  discard block
 block discarded – undo
342 342
    */
343 343
   protected function report_render_outcome_side_fleet_line(&$array, $lang_header_index) {
344 344
     $result = array();
345
-    if(!empty($array)) {
346
-      foreach($array as $unit_id => $unit_count) {
347
-        if($unit_count) {
345
+    if (!empty($array)) {
346
+      foreach ($array as $unit_id => $unit_count) {
347
+        if ($unit_count) {
348 348
           $result[] = array(
349 349
             'NAME' => classLocale::$lang['tech'][$unit_id],
350 350
             'LOSS' => pretty_number($unit_count),
351 351
           );
352 352
         }
353 353
       }
354
-      if($lang_header_index && count($result)) {
354
+      if ($lang_header_index && count($result)) {
355 355
         array_unshift($result, array('NAME' => classLocale::$lang[$lang_header_index]));
356 356
       }
357 357
     }
@@ -364,16 +364,16 @@  discard block
 block discarded – undo
364 364
     $fleet_id = $this->db_id;
365 365
 
366 366
     $unit_sort_order = 0;
367
-    foreach($this->unit_list->_container as $UBEUnit) {
368
-      if($UBEUnit->units_lost || $UBEUnit->units_restored) {
367
+    foreach ($this->unit_list->_container as $UBEUnit) {
368
+      if ($UBEUnit->units_lost || $UBEUnit->units_restored) {
369 369
         $unit_sort_order++;
370 370
         $sql_perform_report_unit[] = array(
371 371
           $ube_report_id,
372 372
           $fleet_id,
373 373
 
374 374
           $UBEUnit->unitId,
375
-          (float)$UBEUnit->units_restored,
376
-          (float)$UBEUnit->units_lost,
375
+          (float) $UBEUnit->units_restored,
376
+          (float) $UBEUnit->units_lost,
377 377
 
378 378
           $unit_sort_order,
379 379
         );
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
   function ube_combat_result_calculate_resources() {
390 390
     $resource_delta_fleet = array();
391 391
     // Если во флоте остались юниты или это планета - генерируем изменение ресурсов
392
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
393
-      $resource_change = (float)$this->resources_looted[$resource_id] + (float)$this->cargo_dropped[$resource_id];
394
-      if($resource_change) {
392
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
393
+      $resource_change = (float) $this->resources_looted[$resource_id] + (float) $this->cargo_dropped[$resource_id];
394
+      if ($resource_change) {
395 395
         $resource_delta_fleet[$resource_id] = -($resource_change);
396 396
       }
397 397
     }
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
     );
425 425
 
426 426
     $this->fleet_capacity = 0;
427
-    foreach($this->unit_list->_container as $UBEUnit) {
427
+    foreach ($this->unit_list->_container as $UBEUnit) {
428 428
       $this->fleet_capacity += $UBEUnit->capacity * $UBEUnit->getCount();
429 429
 
430
-      if($UBEUnit->units_lost) {
431
-        foreach($UBEUnit->price as $resource_id => $unit_resource_price) {
432
-          if(!$unit_resource_price) {
430
+      if ($UBEUnit->units_lost) {
431
+        foreach ($UBEUnit->price as $resource_id => $unit_resource_price) {
432
+          if (!$unit_resource_price) {
433 433
             continue;
434 434
           }
435 435
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
           $this->resources_lost_on_units[$resource_id] += $resources_lost;
438 438
           // Если это корабль - прибавляем потери к обломкам на орбите
439 439
           // TODO - опция выбрасывания обороны в обломки
440
-          if($UBEUnit->getType() == UNIT_SHIPS) {
440
+          if ($UBEUnit->getType() == UNIT_SHIPS) {
441 441
             $this->resources_lost_on_ships[$resource_id] += $resources_lost;
442 442
           }
443 443
         }
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 
450 450
     // Если емкость трюмов меньше количество ресурсов - часть ресов выбрасываем нахуй
451 451
     // На планете ($fleet_id = 0) ресурсы в космос не выбрасываются
452
-    if($this->db_id != 0 && $this->fleet_capacity < $fleet_total_resources) {
452
+    if ($this->db_id != 0 && $this->fleet_capacity < $fleet_total_resources) {
453 453
       $drop_share = 1 - $this->fleet_capacity / $fleet_total_resources; // Какая часть ресурсов выброшена
454
-      foreach($this->resource_list as $resource_id => &$resource_amount) {
454
+      foreach ($this->resource_list as $resource_id => &$resource_amount) {
455 455
         // Не просчитываем ресурсы, которых нет на борту кораблей флота
456
-        if(!$resource_amount) {
456
+        if (!$resource_amount) {
457 457
           continue;
458 458
         }
459 459
 
@@ -474,19 +474,19 @@  discard block
 block discarded – undo
474 474
     $objFleet2->setDbId($this->db_id);
475 475
 
476 476
     // Если это была миссия Уничтожения И звезда смерти взорвалась И мы работаем с аттакерами - значит все аттакеры умерли
477
-    if($this->is_attacker == UBE_PLAYER_IS_ATTACKER && $reapers_status == UBE_MOON_REAPERS_DIED) {
477
+    if ($this->is_attacker == UBE_PLAYER_IS_ATTACKER && $reapers_status == UBE_MOON_REAPERS_DIED) {
478 478
       $objFleet2->dbDelete();
479
-    } elseif($ship_count_initial == 0) { // $ship_count_lost == $ship_count_initial ||
479
+    } elseif ($ship_count_initial == 0) { // $ship_count_lost == $ship_count_initial ||
480 480
       $objFleet2->dbDelete();
481 481
     } else {
482
-      if($ship_count_lost) {
482
+      if ($ship_count_lost) {
483 483
         // Просматриваем результаты изменения флотов
484
-        foreach($this->unit_list->_container as $UBEUnit) {
484
+        foreach ($this->unit_list->_container as $UBEUnit) {
485 485
           // Перебираем аутком на случай восстановления юнитов
486 486
 //          if(($units_left = $UBEUnit->getCount() - (float)$UBEUnit->units_lost) > 0) {
487 487
 //            $fleet_real_array[$UBEUnit->unitId] = $units_left;
488 488
 //          };
489
-          if(floatval($UBEUnit->units_lost) != 0) {
489
+          if (floatval($UBEUnit->units_lost) != 0) {
490 490
             $objFleet2->shipAdjustCount($UBEUnit->unitId, floatval($UBEUnit->units_lost));
491 491
           };
492 492
         }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
       $objFleet2->resourcesAdjust($resource_delta_fleet);
497 497
 
498 498
       // Если защитник и не РМФ - отправляем флот назад
499
-      if($this->is_attacker == UBE_PLAYER_IS_ATTACKER || ($this->is_attacker == UBE_PLAYER_IS_DEFENDER && !$is_small_fleet_recce)) {
499
+      if ($this->is_attacker == UBE_PLAYER_IS_ATTACKER || ($this->is_attacker == UBE_PLAYER_IS_DEFENDER && !$is_small_fleet_recce)) {
500 500
         $objFleet2->markReturned();
501 501
       }
502 502
       $objFleet2->dbSave();
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
   public function calculate_unit_partial_data(UBEASA $side_ASA) {
527 527
     $this->fleet_share_of_side_armor = $this->total_stats[P_ARMOR] / $side_ASA->getArmor();
528 528
 
529
-    foreach($this->unit_list->_container as $UBEUnit) {
529
+    foreach ($this->unit_list->_container as $UBEUnit) {
530 530
       $UBEUnit->share_of_side_armor = $UBEUnit->pool_armor / $side_ASA->getArmor();
531 531
     }
532 532
   }
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
    * @version 2016-02-25 23:42:45 41a4.68
539 539
    */
540 540
   public function attack_fleets(UBEFleetList $fleet_list, $is_simulator) {
541
-    foreach($fleet_list->_container as $defending_fleet) {
541
+    foreach ($fleet_list->_container as $defending_fleet) {
542 542
       // Не атакуются флоты на своей стороне
543
-      if($this->is_attacker == $defending_fleet->is_attacker) {
543
+      if ($this->is_attacker == $defending_fleet->is_attacker) {
544 544
         continue;
545 545
       }
546 546
       $this->attack_fleet($defending_fleet, $is_simulator);
@@ -556,12 +556,12 @@  discard block
 block discarded – undo
556 556
   public function attack_fleet(UBEFleet $defending_fleet, $is_simulator) {
557 557
     UBEDebug::unit_dump_header();
558 558
 
559
-    foreach($this->unit_list->_container as $attacking_unit_pool) {
559
+    foreach ($this->unit_list->_container as $attacking_unit_pool) {
560 560
       UBEDebug::unit_dump($attacking_unit_pool, 'attacker');
561 561
 
562 562
       // if($attack_unit_count <= 0) continue; // TODO: Это пока нельзя включать - вот если будут "боевые порядки юнитов..."
563
-      foreach($defending_fleet->unit_list->_container as $defending_unit_pool) {
564
-        if($defending_unit_pool->isEmpty()) {
563
+      foreach ($defending_fleet->unit_list->_container as $defending_unit_pool) {
564
+        if ($defending_unit_pool->isEmpty()) {
565 565
           continue;
566 566
         }
567 567
 
Please login to merge, or discard this patch.
includes/includes/flt_flying_fleet_handler2.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  *
11 11
  * @param Fleet $objFleet
12 12
  * @param bool  $start
13
- * @param null  $result
13
+ * @param integer  $result
14 14
  *
15 15
  * @return mixed
16 16
  */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,15 +19,11 @@  discard block
 block discarded – undo
19 19
 // ------------------------------------------------------------------
20 20
 function flt_flyingFleetsSort($a, $b) {
21 21
   // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
22
-  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
23
-    // Если время - одинаковое, сравниваем события флотов
22
+  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
24 23
     // Если события - одинаковые, то флоты равны
25
-    ($a['fleet_event'] == $b['fleet_event'] ? 0 :
26
-      // Если события разные - первыми считаем прибывающие флоты
27
-      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
28
-        // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
29
-        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
30
-          // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
24
+    ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
25
+      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
26
+        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
31 27
           // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
32 28
           (
33 29
           0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
@@ -45,7 +41,7 @@  discard block
 block discarded – undo
45 41
     $handler = fopen('event.log', 'a+');
46 42
   }
47 43
 
48
-  fwrite($handler, date(FMT_DATE_TIME_SQL, time()) . ' ' . $msg . "\r\n");
44
+  fwrite($handler, date(FMT_DATE_TIME_SQL, time()).' '.$msg."\r\n");
49 45
 }
50 46
 
51 47
 // ------------------------------------------------------------------
@@ -174,7 +170,7 @@  discard block
 block discarded – undo
174 170
     MT_EXPLORE   => 'flt_mission_explore',
175 171
   );
176 172
   foreach ($missions_used as $mission_id => $cork) {
177
-    require_once(SN_ROOT_PHYSICAL . "includes/includes/{$mission_files[$mission_id]}" . DOT_PHP_EX);
173
+    require_once(SN_ROOT_PHYSICAL."includes/includes/{$mission_files[$mission_id]}".DOT_PHP_EX);
178 174
   }
179 175
 
180 176
 //log_file('Обработка миссий');
Please login to merge, or discard this patch.
includes/vars_combats.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     'shield' => 10,
36 36
     'armor' => 400,
37 37
     'attack' => 5,
38
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
38
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
39 39
   ),
40 40
   SHIP_CARGO_BIG => array(
41 41
     'name' => 'big_ship_cargo',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     'shield' => 25,
56 56
     'armor' => 1200,
57 57
     'attack' => 5,
58
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
58
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
59 59
     'engine' => array(
60 60
       array(
61 61
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     'shield' => 50,
84 84
     'armor' => 3000,
85 85
     'attack' => 10,
86
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
86
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
87 87
     'engine' => array(
88 88
       array(
89 89
         'tech' => TECH_ENGINE_ION,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     'shield' => 200,
112 112
     'armor' => 70000,
113 113
     'attack' => 50,
114
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
114
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
115 115
     'engine' => array(
116 116
       array(
117 117
         'tech' => TECH_ENGINE_HYPER,
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     'shield' => 100,
141 141
     'armor' => 3000,
142 142
     'attack' => 50,
143
-    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
143
+    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
144 144
     'engine' => array(
145 145
       array(
146 146
         'tech' => TECH_ENGINE_ION,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     'shield' => 10,
169 169
     'armor' => 1600,
170 170
     'attack' => 1,
171
-    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050, ),
171
+    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050,),
172 172
     'engine' => array(
173 173
       array(
174 174
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'shield' =>  0.01,
197 197
     'armor' => 100,
198 198
     'attack' =>  0.01,
199
-    'amplify' => array( SHIP_SPY => 1,),
199
+    'amplify' => array(SHIP_SPY => 1,),
200 200
     'engine' => array(
201 201
       array(
202 202
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
       'factor' => 1,
221 221
     ),
222 222
     P_UNIT_PRODUCTION => array(
223
-      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor);},
223
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); },
224 224
     ),
225 225
     P_MINING_IS_MANAGED => true,
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     'shield' => 10,
230 230
     'armor' => 200,
231 231
     'attack' => 1,
232
-    'amplify' => array(SHIP_SPY => 1, ),
232
+    'amplify' => array(SHIP_SPY => 1,),
233 233
     'engine' => array(
234 234
       array(
235 235
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     'shield' => 10,
262 262
     'armor' => 400,
263 263
     'attack' => 50,
264
-    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
264
+    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
265 265
     'engine' => array(
266 266
       array(
267 267
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     'shield' => 25,
291 291
     'armor' => 1000,
292 292
     'attack' => 150,
293
-    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7, ),
293
+    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7,),
294 294
     'engine' => array(
295 295
       array(
296 296
         'tech' => TECH_ENGINE_ION,
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     'shield' =>  50,
350 350
     'armor' => 2700,
351 351
     'attack' => 400,
352
-    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5, ),
352
+    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5,),
353 353
     'engine' => array(
354 354
       array(
355 355
         'tech' => TECH_ENGINE_ION,
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     'shield' =>  200,
409 409
     'armor' =>  6000,
410 410
     'attack' => 1000,
411
-    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76, ),
411
+    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76,),
412 412
     'engine' => array(
413 413
       array(
414 414
         'tech' => TECH_ENGINE_HYPER,
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     'shield' =>  500,
505 505
     'armor' => 11000,
506 506
     'attack' => 2000,
507
-    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125, ),
507
+    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125,),
508 508
     'engine' => array(
509 509
       array(
510 510
         'tech' => TECH_ENGINE_HYPER,
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     'shield' => 20,
609 609
     'armor' => 200,
610 610
     'attack' => 80,
611
-    'amplify' => array(SHIP_SPY => 7, ),
611
+    'amplify' => array(SHIP_SPY => 7,),
612 612
   ),
613 613
   UNIT_DEF_TURRET_LASER_SMALL => array(
614 614
     'name' => 'small_laser',
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     'shield' => 25,
627 627
     'armor' => 200,
628 628
     'attack' => 100,
629
-    'amplify' => array(SHIP_SPY => 5, ),
629
+    'amplify' => array(SHIP_SPY => 5,),
630 630
   ),
631 631
   UNIT_DEF_TURRET_LASER_BIG => array(
632 632
     'name' => 'big_laser',
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     'shield' => 100,
645 645
     'armor' => 800,
646 646
     'attack' => 250,
647
-    'amplify' => array(SHIP_SPY => 2, ),
647
+    'amplify' => array(SHIP_SPY => 2,),
648 648
   ),
649 649
   UNIT_DEF_TURRET_GAUSS => array(
650 650
     'name' => 'gauss_canyon',
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     'armor' => 3500,
663 663
     'shield' => 200,
664 664
     'attack' => 1100,
665
-    'amplify' => array(SHIP_SPY => 0.5, ),
665
+    'amplify' => array(SHIP_SPY => 0.5,),
666 666
   ),
667 667
   UNIT_DEF_TURRET_ION => array(
668 668
     'name' => 'ionic_canyon',
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     'shield' => 500,
681 681
     'armor' => 800,
682 682
     'attack' => 150,
683
-    'amplify' => array(SHIP_SPY => 3.3, ),
683
+    'amplify' => array(SHIP_SPY => 3.3,),
684 684
   ),
685 685
   UNIT_DEF_TURRET_PLASMA => array(
686 686
     'name' => 'buster_canyon',
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
     'shield' => 300,
699 699
     'armor' => 10000,
700 700
     'attack' => 3000,
701
-    'amplify' => array(SHIP_SPY => 0.17, ),
701
+    'amplify' => array(SHIP_SPY => 0.17,),
702 702
   ),
703 703
 
704 704
   UNIT_DEF_SHIELD_SMALL => array(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     'shield' => 2000,
719 719
     'armor' => 2000,
720 720
     'attack' => 1,
721
-    'amplify' => array(SHIP_SPY => 500, ),
721
+    'amplify' => array(SHIP_SPY => 500,),
722 722
   ),
723 723
   UNIT_DEF_SHIELD_BIG => array(
724 724
     'name' => 'big_protection_shield',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     'shield' => 2000,
738 738
     'armor' => 10000,
739 739
     'attack' => 1,
740
-    'amplify' => array(SHIP_SPY => 500, ),
740
+    'amplify' => array(SHIP_SPY => 500,),
741 741
   ),
742 742
   UNIT_DEF_SHIELD_PLANET => array(
743 743
     'name'      => 'planet_protector',
Please login to merge, or discard this patch.
includes/classes/module.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -239,6 +239,9 @@
 block discarded – undo
239 239
     }
240 240
   }
241 241
 
242
+  /**
243
+   * @param string $arrayName
244
+   */
242 245
   protected function mergeArraySpecial($arrayName) {
243 246
     global $sn_mvc;
244 247
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
   }
74 74
 
75 75
   function loadModuleRootConfig() {
76
-    require SN_ROOT_PHYSICAL . 'config.php';
76
+    require SN_ROOT_PHYSICAL.'config.php';
77 77
 
78
-    $module_config_array = get_class($this) . '_config';
79
-    if(!empty($$module_config_array) && is_array($$module_config_array)) {
78
+    $module_config_array = get_class($this).'_config';
79
+    if (!empty($$module_config_array) && is_array($$module_config_array)) {
80 80
       $this->config = $$module_config_array;
81 81
 
82 82
       return true;
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 
95 95
     // TODO: Load configuration from DB. Manifest setting
96 96
     // Trying to load configuration from file
97
-    if(!$config_exists = $this->loadModuleRootConfig()) {
97
+    if (!$config_exists = $this->loadModuleRootConfig()) {
98 98
       // Конфигурация может лежать в config_path в манифеста или в корне модуля
99
-      if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) {
99
+      if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'].'/config.php')) {
100 100
         $config_exists = true;
101
-      } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) {
101
+      } elseif (file_exists($config_filename = dirname($filename).'/config.php')) {
102 102
         $config_exists = true;
103 103
       }
104 104
 
105
-      if($config_exists) {
105
+      if ($config_exists) {
106 106
         include($config_filename);
107
-        $module_config_array = $class_module_name . '_config';
107
+        $module_config_array = $class_module_name.'_config';
108 108
         $this->config = $$module_config_array;
109 109
       }
110 110
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     // Checking module status - is it installed and active
121 121
     $this->check_status();
122
-    if(!$this->manifest['active']) {
122
+    if (!$this->manifest['active']) {
123 123
       return;
124 124
     }
125 125
 
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 
140 140
   protected function setSystemConstants() {
141 141
     // Setting constants - if any
142
-    if(empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
142
+    if (empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
143 143
       return;
144 144
     }
145 145
 
146
-    foreach($this->manifest['constants'] as $constant_name => $constant_value) {
146
+    foreach ($this->manifest['constants'] as $constant_name => $constant_value) {
147 147
       !defined($constant_name) ? define($constant_name, $constant_value) : false;
148 148
     }
149 149
   }
@@ -155,48 +155,48 @@  discard block
 block discarded – undo
155 155
     // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays)
156 156
     // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]'
157 157
     $this->manifest['vars'] = $this->__assign_vars();
158
-    if(empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
158
+    if (empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
159 159
       return;
160 160
     }
161 161
 
162 162
     $vars_assigned = array();
163
-    foreach($this->manifest['vars'] as $var_name => $var_value) {
163
+    foreach ($this->manifest['vars'] as $var_name => $var_value) {
164 164
       $sub_vars = explode('[', str_replace(']', '', $var_name));
165 165
       $var_name = $sub_vars[0];
166 166
 
167
-      if(!isset($vars_assigned[$var_name])) {
167
+      if (!isset($vars_assigned[$var_name])) {
168 168
         $vars_assigned[$var_name] = true;
169 169
         global $$var_name;
170 170
       }
171 171
 
172 172
       $pointer = &$$var_name;
173
-      if(($n = count($sub_vars)) > 1) {
174
-        for($i = 1; $i < $n; $i++) {
175
-          if(defined($sub_vars[$i])) {
173
+      if (($n = count($sub_vars)) > 1) {
174
+        for ($i = 1; $i < $n; $i++) {
175
+          if (defined($sub_vars[$i])) {
176 176
             $sub_vars[$i] = constant($sub_vars[$i]);
177 177
           }
178 178
 
179
-          if(!isset($pointer[$sub_vars[$i]]) && $i != $n) {
179
+          if (!isset($pointer[$sub_vars[$i]]) && $i != $n) {
180 180
             $pointer[$sub_vars[$i]] = array();
181 181
           }
182 182
           $pointer = &$pointer[$sub_vars[$i]];
183 183
         }
184 184
       }
185 185
 
186
-      if(!isset($pointer) || !is_array($pointer)) {
186
+      if (!isset($pointer) || !is_array($pointer)) {
187 187
         $pointer = $var_value;
188
-      } elseif(is_array($$var_name)) {
188
+      } elseif (is_array($$var_name)) {
189 189
         $pointer = array_merge_recursive_numeric($pointer, $var_value);
190 190
       }
191 191
     }
192 192
   }
193 193
 
194 194
   protected function mergeMenu(&$sn_menu_extra, &$menu_patch) {
195
-    if(!is_array($menu_patch)) {
195
+    if (!is_array($menu_patch)) {
196 196
       return;
197 197
     }
198 198
 
199
-    foreach($menu_patch as $menu_item_name => $menu_item_data) {
199
+    foreach ($menu_patch as $menu_item_name => $menu_item_data) {
200 200
       $sn_menu_extra[$menu_item_name] = $menu_item_data;
201 201
     }
202 202
   }
@@ -205,34 +205,34 @@  discard block
 block discarded – undo
205 205
     // Overriding function if any
206 206
     sn_sys_handler_add(classSupernova::$functions, $this->manifest['functions'], $this);
207 207
 
208
-    foreach(classSupernova::$sn_mvc as $handler_type => &$handler_data) {
208
+    foreach (classSupernova::$sn_mvc as $handler_type => &$handler_data) {
209 209
       sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type);
210 210
     }
211 211
   }
212 212
 
213 213
   protected function mergeNavbarButton() {
214
-    if(empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
214
+    if (empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
215 215
       return;
216 216
     }
217 217
 
218
-    foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
218
+    foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
219 219
       classSupernova::$sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative;
220 220
     }
221 221
   }
222 222
 
223 223
   protected function mergeI18N() {
224 224
     $arrayName = 'i18n';
225
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
225
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
226 226
       return;
227 227
     }
228 228
 
229
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
230
-      foreach($contentList as &$i18n_file_data) {
231
-        if(is_array($i18n_file_data) && !$i18n_file_data['path']) {
229
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
230
+      foreach ($contentList as &$i18n_file_data) {
231
+        if (is_array($i18n_file_data) && !$i18n_file_data['path']) {
232 232
           $i18n_file_data['path'] = $this->manifest['root_relative'];
233 233
         }
234 234
       }
235
-      if(!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) {
235
+      if (!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) {
236 236
         classSupernova::$sn_mvc[$arrayName][$pageName] = array();
237 237
       }
238 238
       classSupernova::$sn_mvc[$arrayName][$pageName] += $contentList;
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
   }
241 241
 
242 242
   protected function mergeArraySpecial($arrayName) {
243
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
243
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
244 244
       return;
245 245
     }
246 246
 
247
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
247
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
248 248
       !isset(classSupernova::$sn_mvc[$arrayName][$pageName]) ? classSupernova::$sn_mvc[$arrayName][$pageName] = array() : false;
249
-      foreach($contentList as $contentName => &$content) {
249
+      foreach ($contentList as $contentName => &$content) {
250 250
         classSupernova::$sn_mvc[$arrayName][$pageName][$contentName] = $content;
251 251
       }
252 252
     }
Please login to merge, or discard this patch.