Completed
Push — work-fleets ( 006942...3604bd )
by SuperNova.WS
06:54
created
classes/UBE/UBERoundList.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
    */
26 26
   public function report_render_rounds(&$template_result, UBE $ube) {
27 27
     $round_count = $this->count();
28
-    for($round = 1; $round <= $round_count - 1; $round++) {
28
+    for ($round = 1; $round <= $round_count - 1; $round++) {
29 29
       $template_result['.']['round'][] = array(
30 30
         'NUMBER' => $round,
31 31
         '.'      => array(
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
    */
49 49
   public function sql_generate_unit_array(array &$sql_perform_ube_report_unit, $ube_report_id, UBEFleetList $UBEFleetList) {
50 50
     $unit_sort_order = 1;
51
-    foreach($this->_container as $round_number => $UBERound) {
51
+    foreach ($this->_container as $round_number => $UBERound) {
52 52
       $outer_prefix = array(
53 53
         $ube_report_id,
54 54
         $round_number,
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
    */
67 67
   public function db_load_round_list_from_report_row($report_row, UBE $ube) {
68 68
     $query = doquery("SELECT * FROM {{ube_report_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_unit_id`");
69
-    while($report_unit_row = db_fetch($query)) {
69
+    while ($report_unit_row = db_fetch($query)) {
70 70
       $round_number = $report_unit_row['ube_report_unit_round'];
71
-      if(!isset($this[$round_number])) {
71
+      if (!isset($this[$round_number])) {
72 72
         $this[$round_number] = new UBERound();
73 73
         $this[$round_number]->init_round_from_report_unit_row($report_unit_row);
74 74
       }
Please login to merge, or discard this patch.
classes/UBE/UBEDebris.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
    */
28 28
   public function debris_add_resource($resource_id, $resource_amount) {
29 29
     // В обломках может быть только металл или кристалл
30
-    if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
30
+    if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
31 31
       return;
32 32
     }
33 33
     $this->debris[$resource_id] += $resource_amount;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
    * @param bool  $is_simulator
39 39
    */
40 40
   public function add_wrecks(array $wreckage, $is_simulator) {
41
-    foreach($wreckage as $resource_id => $resource_amount) {
41
+    foreach ($wreckage as $resource_id => $resource_amount) {
42 42
       $this->debris_add_resource($resource_id, floor($resource_amount *
43 43
         ($is_simulator
44 44
           ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
    * @param bool  $is_simulator
55 55
    */
56 56
   public function add_cargo_drop(array $dropped_resources, $is_simulator) {
57
-    foreach($dropped_resources as $resource_id => $resource_amount) {
57
+    foreach ($dropped_resources as $resource_id => $resource_amount) {
58 58
       $this->debris_add_resource($resource_id, floor($resource_amount *
59 59
         ($is_simulator
60 60
           ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
    * @param $moon_debris_left_part
94 94
    */
95 95
   public function debris_adjust_proportional($moon_debris_left_part) {
96
-    foreach($this->debris as $resource_id => &$resource_amount) {
96
+    foreach ($this->debris as $resource_id => &$resource_amount) {
97 97
       $resource_amount = floor($resource_amount * $moon_debris_left_part);
98 98
     }
99 99
   }
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
    */
115 115
   public function report_generate_array() {
116 116
     return array(
117
-      'ube_report_debris_metal'          => (float)$this->debris_get_resource(RES_METAL),
118
-      'ube_report_debris_crystal'        => (float)$this->debris_get_resource(RES_CRYSTAL),
119
-      'ube_report_debris_total_in_metal' => (float)$this->debris_in_metal(),
117
+      'ube_report_debris_metal'          => (float) $this->debris_get_resource(RES_METAL),
118
+      'ube_report_debris_crystal'        => (float) $this->debris_get_resource(RES_CRYSTAL),
119
+      'ube_report_debris_total_in_metal' => (float) $this->debris_in_metal(),
120 120
     );
121 121
   }
122 122
 
Please login to merge, or discard this patch.
classes/UBE/ContainerArrayOfObject.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
    * @param array  $arguments
20 20
    */
21 21
   public function __call($method_name, array $arguments) {
22
-    foreach($this->_container as $object) {
23
-      if(is_object($object) && method_exists($object, $method_name)) {
22
+    foreach ($this->_container as $object) {
23
+      if (is_object($object) && method_exists($object, $method_name)) {
24 24
         call_user_func_array(array($object, $method_name), $arguments);
25 25
       }
26 26
     }
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
    */
36 36
   public function getSumProperty($property_name) {
37 37
     $result = 0.0;
38
-    foreach($this->_container as $object) {
39
-      if(is_object($object) && property_exists($object, $property_name)) {
38
+    foreach ($this->_container as $object) {
39
+      if (is_object($object) && property_exists($object, $property_name)) {
40 40
         $result += $object->$property_name;
41 41
       }
42 42
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
    * @return mixed
53 53
    */
54 54
   public function aggregateByMethod($method_name, &$result) {
55
-    foreach($this->_container as $object) {
56
-      if(is_object($object) && method_exists($object, $method_name)) {
55
+    foreach ($this->_container as $object) {
56
+      if (is_object($object) && method_exists($object, $method_name)) {
57 57
         call_user_func(array($object, $method_name), $result);
58 58
       }
59 59
     }
Please login to merge, or discard this patch.
classes/UBE/UBEUnit.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     parent::setUnitId($unitId);
51 51
 
52 52
     // Reset combat stats??
53
-    if($this->_unitId) {
53
+    if ($this->_unitId) {
54 54
       $this->amplify = $this->info[P_AMPLIFY];
55 55
       $this->capacity = $this->info[P_CAPACITY];
56 56
       $this->price[RES_METAL] = $this->info[P_COST][RES_METAL];
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     $this->bonus_attack = $this->info[P_ATTACK];
73 73
     $this->bonus_shield = $this->info[P_SHIELD];
74 74
     $this->bonus_armor = $this->info[P_ARMOR];
75
-    if(is_object($this->unit_bonus)) {
75
+    if (is_object($this->unit_bonus)) {
76 76
       $this->bonus_attack = floor($this->bonus_attack * $this->unit_bonus->calcBonus(P_ATTACK));
77 77
       $this->bonus_shield = floor($this->bonus_shield * $this->unit_bonus->calcBonus(P_SHIELD));
78 78
       $this->bonus_armor = floor($this->bonus_armor * $this->unit_bonus->calcBonus(P_ARMOR));
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $this->randomized_attack = $this->bonus_attack;
81 81
     $this->randomized_shield = $this->bonus_shield;
82 82
     $this->randomized_armor = $this->bonus_armor;
83
-    if(!$is_simulator) {
83
+    if (!$is_simulator) {
84 84
       // TODO - randomize attack if is not simulator
85 85
       $this->randomized_attack = floor($this->bonus_attack * ($is_simulator ? 1 : mt_rand(UBE_RANDOMIZE_FROM, UBE_RANDOMIZE_TO) / 100));
86 86
       $this->randomized_shield = floor($this->bonus_shield * ($is_simulator ? 1 : mt_rand(UBE_RANDOMIZE_FROM, UBE_RANDOMIZE_TO) / 100));
@@ -159,22 +159,22 @@  discard block
 block discarded – undo
159 159
    * @version 2016-02-25 23:42:45 41a4.68
160 160
    */
161 161
   public function restore_unit($is_simulator) {
162
-    if($this->_type != UNIT_DEFENCE || $this->units_lost <= 0) {
162
+    if ($this->_type != UNIT_DEFENCE || $this->units_lost <= 0) {
163 163
       return;
164 164
     }
165 165
 
166
-    if($is_simulator) {
166
+    if ($is_simulator) {
167 167
       $units_giveback = round($this->units_lost * UBE_DEFENCE_RESTORATION_CHANCE_AVG / 100); // for simulation just return 75% of loss
168 168
     } else {
169 169
       // Checking - should we trigger mass-restore
170
-      if($this->units_lost >= UBE_DEFENCE_RESTORATION_MASS_COUNT) {
170
+      if ($this->units_lost >= UBE_DEFENCE_RESTORATION_MASS_COUNT) {
171 171
         // For large amount - mass-restoring defence
172 172
         $units_giveback = round($this->units_lost * mt_rand(UBE_DEFENCE_RESTORATION_CHANCE_MIN, UBE_DEFENCE_RESTORATION_CHANCE_MAX) / 100);
173 173
       } else {
174 174
         // For small amount - restoring defence per single unit
175 175
         $units_giveback = 0;
176
-        for($i = 1; $i <= $this->units_lost; $i++) {
177
-          if(mt_rand(1, 100) <= UBE_DEFENCE_RESTORATION_CHANCE_AVG) {
176
+        for ($i = 1; $i <= $this->units_lost; $i++) {
177
+          if (mt_rand(1, 100) <= UBE_DEFENCE_RESTORATION_CHANCE_AVG) {
178 178
             $units_giveback++;
179 179
           }
180 180
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
    */
194 194
   public function receive_damage($is_simulator) {
195 195
     // TODO - Добавить взрывы от полуповрежденных юнитов - т.е. заранее вычислить из убитых юнитов еще количество убитых умножить на вероятность от структуры
196
-    if($this->_count <= 0) {
196
+    if ($this->_count <= 0) {
197 197
       return;
198 198
     }
199 199
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     $this->adjustCount(-$units_lost);
217 217
 
218 218
     // Проверяем - не взорвался ли текущий юнит
219
-    while($this->_count > 0 && $this->attack_income > 0) {
219
+    while ($this->_count > 0 && $this->attack_income > 0) {
220 220
       $this->attack_damaged_unit($is_simulator);
221 221
     }
222 222
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     $armor_left = $this->pool_armor % $this->randomized_armor;
242 242
     // Проверка - не атакуем ли мы целый корабль
243 243
     // Такое может быть, если на прошлой итерации поврежденный корабль был взорван и еще осталась входящяя атака
244
-    if($shield_left == 0 && $armor_left == 0) {
244
+    if ($shield_left == 0 && $armor_left == 0) {
245 245
       $shield_left = $this->randomized_shield;
246 246
       $armor_left = $this->randomized_armor;
247 247
     }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     // Вычитаем этот дамадж из щитов пула
256 256
     $this->pool_shield -= $damage_to_shield;
257 257
     // Если весь дамадж был поглощён щитами - выходим
258
-    if($this->attack_income <= 0) {
258
+    if ($this->attack_income <= 0) {
259 259
       return;
260 260
     }
261 261
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     $armor_left -= $damage_to_armor;
273 273
 
274 274
     // Проверяем - осталась ли броня на текущем корабле и вааще
275
-    if($this->pool_armor <= 0 || $armor_left <= 0) {
275
+    if ($this->pool_armor <= 0 || $armor_left <= 0) {
276 276
       // Не осталось - корабль уничтожен
277 277
       $this->adjustCount(-1);
278 278
 
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
     $armor_left_percent = $armor_left / $this->randomized_armor * 100;
284 284
     // Проверяем % здоровья
285 285
     // TODO - сделать динамический процент для каждого вида юнитов
286
-    if($armor_left_percent <= UBE_CRITICAL_DAMAGE_THRESHOLD) {
286
+    if ($armor_left_percent <= UBE_CRITICAL_DAMAGE_THRESHOLD) {
287 287
       // Дамадж пошёл по структуре. Чем более поврежден юнит - тем больше шансов у него взорваться
288 288
       $random = $is_simulator ? UBE_CRITICAL_DAMAGE_THRESHOLD / 2 : mt_rand(0, 100);
289
-      if($random >= $armor_left_percent) {
289
+      if ($random >= $armor_left_percent) {
290 290
         $this->adjustCount(-1);
291 291
         $this->unit_count_boom++;
292 292
 
Please login to merge, or discard this patch.
classes/Account.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     $this->reset();
80 80
     $this->db = is_object($db) ? $db : classSupernova::$db;
81 81
 
82
-    foreach($this->table_check as $table_name) {
83
-      if(empty($this->db->table_list[$table_name])) {
82
+    foreach ($this->table_check as $table_name) {
83
+      if (empty($this->db->table_list[$table_name])) {
84 84
         die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br />
85 85
               В противном случае - сообщите Администрации сервера об ошибке.<br/>
86 86
               Не хватает таблицы для работы системы авторизации: ' . $table_name);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
    */
105 105
   // OK v4.6
106 106
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
107
-    if(!$this->password_check($old_password_unsafe)) {
107
+    if (!$this->password_check($old_password_unsafe)) {
108 108
       return false;
109 109
     }
110 110
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   // OK v4.5
126 126
   public function assign_from_db_row($row) {
127 127
     $this->reset();
128
-    if(empty($row) || !is_array($row)) {
128
+    if (empty($row) || !is_array($row)) {
129 129
       return false;
130 130
     }
131 131
     $this->account_id = $row['account_id'];
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         `account_email` = LOWER('{$email_safe}'),
243 243
         `account_language` = '{$language_safe}'"
244 244
     );
245
-    if(!$result) {
245
+    if (!$result) {
246 246
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
247 247
     }
248 248
 
249
-    if(!($account_id = $this->db->db_insert_id())) {
249
+    if (!($account_id = $this->db->db_insert_id())) {
250 250
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
251 251
     }
252 252
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
       WHERE `account_id` = '{$account_id_safe}'"
277 277
     ) ? true : false;
278 278
 
279
-    if($result) {
279
+    if ($result) {
280 280
       $result = $this->db_get_by_id($this->account_id);
281 281
     }
282 282
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
   public function metamatter_change($change_type, $metamatter, $comment = '', $already_changed = false) {
364 364
     global $mm_change_legit;
365 365
 
366
-    if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
366
+    if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
367 367
       classSupernova::$debug->error('Ошибка при попытке манипуляции с ММ');
368 368
 
369 369
       return false;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
     $mm_change_legit = true;
375 375
     // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER);
376
-    if($already_changed) {
376
+    if ($already_changed) {
377 377
       $metamatter_total_delta = 0;
378 378
       $result = -1;
379 379
     } else {
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
       $result = $this->db->doquery(
384 384
         "UPDATE {{account}}
385 385
         SET
386
-          `account_metamatter` = `account_metamatter` + '{$metamatter}'" .
387
-        ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') .
386
+          `account_metamatter` = `account_metamatter` + '{$metamatter}'".
387
+        ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '').
388 388
         " WHERE `account_id` = {$account_id_safe}"
389 389
       );
390
-      if(!$result) {
390
+      if (!$result) {
391 391
         classSupernova::$debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
392 392
       }
393 393
       $result = classSupernova::$db->db_affected_rows();
394 394
     }
395 395
 
396
-    if(empty(core_auth::$user['id'])) {
396
+    if (empty(core_auth::$user['id'])) {
397 397
       $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id);
398 398
       reset($user_list);
399 399
       $user_id_unsafe = key($user_list);
@@ -402,30 +402,30 @@  discard block
 block discarded – undo
402 402
     }
403 403
     $user_id_safe = $this->db->db_escape($user_id_unsafe);
404 404
 
405
-    if(!$result) {
405
+    if (!$result) {
406 406
       classSupernova::$debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
407 407
     }
408 408
 
409
-    if(!$already_changed) {
409
+    if (!$already_changed) {
410 410
       $this->account_metamatter += $metamatter;
411 411
       $this->account_metamatter_total += $metamatter_total_delta;
412 412
     }
413 413
 
414
-    if(is_array($comment)) {
414
+    if (is_array($comment)) {
415 415
       $comment = call_user_func_array('sprintf', $comment);
416 416
     }
417 417
 
418 418
     $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe);
419 419
 
420
-    if($metamatter > 0 && !empty($user_id_safe)) {
420
+    if ($metamatter > 0 && !empty($user_id_safe)) {
421 421
       $old_referral = db_referral_get_by_id($user_id_safe);
422
-      if($old_referral['id']) {
422
+      if ($old_referral['id']) {
423 423
         $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM;
424 424
         db_referral_update_dm($user_id_safe, $dark_matter_from_metamatter);
425 425
         $new_referral = db_referral_get_by_id($user_id_safe);
426 426
 
427 427
         $partner_bonus = floor($new_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) : 0);
428
-        if($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
428
+        if ($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
429 429
           rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}");
430 430
         }
431 431
       }
Please login to merge, or discard this patch.
Doc Comments   +21 added lines patch added patch discarded remove patch
@@ -171,6 +171,10 @@  discard block
 block discarded – undo
171 171
    * @return bool
172 172
    */
173 173
   // OK v4.5
174
+
175
+  /**
176
+   * @param string $account_name_unsafe
177
+   */
174 178
   public function db_get_by_name($account_name_unsafe) {
175 179
     $this->reset();
176 180
 
@@ -207,6 +211,11 @@  discard block
 block discarded – undo
207 211
    *
208 212
    */
209 213
   // OK v4.5
214
+
215
+  /**
216
+   * @param string $account_name_unsafe
217
+   * @param string $email_unsafe
218
+   */
210 219
   public function db_get_by_name_or_email($account_name_unsafe, $email_unsafe) {
211 220
     $this->reset();
212 221
 
@@ -223,6 +232,13 @@  discard block
 block discarded – undo
223 232
    * @throws Exception
224 233
    */
225 234
   // OK v4.5
235
+
236
+  /**
237
+   * @param string $account_name_unsafe
238
+   * @param string $password_raw
239
+   * @param string $email_unsafe
240
+   * @param string $language_unsafe
241
+   */
226 242
   public function db_create($account_name_unsafe, $password_raw, $email_unsafe, $language_unsafe = null, $salt_unsafe = null) {
227 243
     $this->reset();
228 244
 
@@ -317,6 +333,11 @@  discard block
 block discarded – undo
317 333
    * @return int|string
318 334
    */
319 335
   // OK 4.8
336
+
337
+  /**
338
+   * @param integer $change_type
339
+   * @param double $metamatter
340
+   */
320 341
   protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe) {
321 342
     $provider_id_safe = intval(core_auth::$main_provider->provider_id);
322 343
     //$account_id_safe = $this->db->db_escape($this->account_id);
Please login to merge, or discard this patch.
classes/DbSqlAware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
    */
46 46
   protected function quoteStringAsFieldByRef(&$string) {
47 47
     $string = $this->stringEscape($string);
48
-    if ((string)$string && '*' != $string) {
49
-      $string = '`' . $string . '`';
48
+    if ((string) $string && '*' != $string) {
49
+      $string = '`'.$string.'`';
50 50
     }
51 51
   }
52 52
 
Please login to merge, or discard this patch.
classes/FleetValidator.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     'checkSpeedPercentOld'       => FLIGHT_FLEET_SPEED_WRONG,
15 15
     'checkTargetInUniverse'      => FLIGHT_VECTOR_BEYOND_UNIVERSE,
16 16
     'checkTargetNotSource'       => FLIGHT_VECTOR_SAME_SOURCE,
17
-    'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN,  // tODO
17
+    'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN, // tODO
18 18
     'checkTargetNoVacation'      => FLIGHT_PLAYER_VACATION,
19 19
     'checkFleetNotEmpty'         => FLIGHT_SHIPS_NO_SHIPS,
20 20
     // 'checkUnitsPositive'         => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
       $checkResult = call_user_func(array($this, $condition));
135 135
       defined('DEBUG_FLEET_MISSION_VALIDATE_DUMP_STEPS')
136
-        ? pdump($action, $condition . ' ' . ($checkResult ? 'TRUE' : 'FALSE')) : false;
136
+        ? pdump($action, $condition.' '.($checkResult ? 'TRUE' : 'FALSE')) : false;
137 137
 
138 138
       // If check failed and there no alternative actions - throw exception
139 139
       // Shortcut ACTION => FAIL_STATUS instead of ACTION => array(false => FAIL_STATUS)
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $this->checkMissionRestrictions($action);
157 157
       } else {
158 158
         // No - then just performing action
159
-        if($exception) {
159
+        if ($exception) {
160 160
           throw new ExceptionFleetInvalid($action, $action);
161 161
         } else {
162 162
           return $action;
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
   protected function checkMissionPrefix($name, $prefix) {
599 599
     $result = false;
600 600
     if (strpos($name, $prefix) === 0) {
601
-      $mission = 'MT_' . strtoupper(substr($name, strlen($prefix)));
601
+      $mission = 'MT_'.strtoupper(substr($name, strlen($prefix)));
602 602
       if (!defined($mission)) {
603 603
         // TODO - Ну, как-то получше это обделать
604
-        throw new Exception('Mission type "' . $mission . '" is not defined', FLIGHT_MISSION_UNKNOWN);
604
+        throw new Exception('Mission type "'.$mission.'" is not defined', FLIGHT_MISSION_UNKNOWN);
605 605
       }
606 606
 
607 607
       $result = constant($mission);
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 
821 821
 
822 822
   /**
823
-   * @return int
823
+   * @return boolean
824 824
    */
825 825
   protected function checkExpeditionsMax() {
826 826
     return get_player_max_expeditons($this->fleet->dbOwnerRow) > 0;
@@ -920,6 +920,10 @@  discard block
 block discarded – undo
920 920
       $this->checkMissionExact($missionType);
921 921
   }
922 922
 
923
+  /**
924
+   * @param integer $missionType
925
+   * @param boolean $result
926
+   */
923 927
   protected function checkMissionResultAndUnset($missionType, $result, $forceMission = false) {
924 928
     $this->unsetMission($missionType, $result, $forceMission);
925 929
 
Please login to merge, or discard this patch.
classes/oldArrayAccessNd.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     !is_array($offset) ? $offset = array($offset) : false;
39 39
 
40 40
     $current_leaf = $this->__get(reset($offset));
41
-    while(($leaf_index = next($offset)) !== false) {
42
-      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
41
+    while (($leaf_index = next($offset)) !== false) {
42
+      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
43 43
         unset($current_leaf);
44 44
         break;
45 45
       }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
     !is_array($offset) ? $offset = array($offset) : false;
66 66
 
67
-    if($this->offsetExists($offset)) {
67
+    if ($this->offsetExists($offset)) {
68 68
       $result = $this->__get(reset($offset));
69
-      while(($leaf_index = next($offset)) !== false) {
69
+      while (($leaf_index = next($offset)) !== false) {
70 70
         $result = $result[$leaf_index];
71 71
       }
72 72
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function offsetSet($offset, $value = null) {
93 93
     // Если нет никакого индекса - значит нечего записывать
94
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
94
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
95 95
       return;
96 96
     }
97 97
 
98 98
     // Если в массиве индекса только один элемент - значит это просто индекс
99
-    if(is_array($offset) && count($offset) == 1) {
99
+    if (is_array($offset) && count($offset) == 1) {
100 100
       // Разворачиваем его в индекс
101 101
       $offset = array(reset($offset) => $value);
102 102
       unset($value);
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     // Адресация многомерного массива через массив индексов в $option
107
-    if(is_array($offset) && isset($value)) {
107
+    if (is_array($offset) && isset($value)) {
108 108
       // TODO - а не переделать ли это всё на __isset() ??
109 109
 //pdump($offset, '$offset');
110 110
 //pdump($value, '$value');
111 111
       // Вытаскиваем корневой элемент
112 112
       $root = $this->__get(reset($offset));
113 113
       $current_leaf = &$root;
114
-      while(($leaf_index = next($offset)) !== false) {
114
+      while (($leaf_index = next($offset)) !== false) {
115 115
         !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false;
116 116
         $current_leaf = &$current_leaf[$leaf_index];
117 117
       }
118 118
 //pdump($current_leaf, '$current_leaf');
119 119
 //pdump($value, '$value');
120
-      if($current_leaf != $value) {
120
+      if ($current_leaf != $value) {
121 121
         $current_leaf = $value;
122 122
 //pdump(reset($offset), 'reset($offset)');
123 123
 //pdump($root, '$root');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       // Пакетная запись из массива ключ -> значение
129 129
       !is_array($offset) ? $offset = array($offset => $value) : false;
130 130
 
131
-      foreach($offset as $key => $value) {
131
+      foreach ($offset as $key => $value) {
132 132
         $this->__get($key) !== $value ? $this->__set($key, $value) : false;
133 133
       }
134 134
     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
    */
150 150
   public function offsetUnset($offset) {
151 151
     // Если нет никакого индекса - значит нечего записывать
152
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
152
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
153 153
       return;
154 154
     }
155 155
 
156 156
     !is_array($offset) ? $offset = array($offset) : false;
157 157
 
158
-    if($this->offsetExists($offset)) {
158
+    if ($this->offsetExists($offset)) {
159 159
 //pdump($offset);
160 160
       // Перематываем массив в конец
161 161
       $key_to_delete = end($offset);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 //pdump($key_to_delete, '$key_to_delete');
164 164
       $parent_offset = $offset;
165 165
       array_pop($parent_offset);
166
-      if(!count($parent_offset)) {
166
+      if (!count($parent_offset)) {
167 167
         // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент
168 168
         $this->__unset($key_to_delete);
169 169
       } else {
Please login to merge, or discard this patch.
classes/auth_abstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
    */
36 36
   // OK 4.9
37 37
   public function __construct($filename = __FILE__) {
38
-    if($this->provider_id == ACCOUNT_PROVIDER_NONE) {
38
+    if ($this->provider_id == ACCOUNT_PROVIDER_NONE) {
39 39
       die('У всех провайдеров должен быть $provider_id!');
40 40
     }
41 41
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
   // OK 4.6
134 134
   public function player_name_suggest() {
135 135
     $name = '';
136
-    if(is_object($this->account) && !empty($this->account->account_email)) {
136
+    if (is_object($this->account) && !empty($this->account->account_email)) {
137 137
       list($name) = explode('@', $this->account->account_email);
138 138
     }
139 139
 
Please login to merge, or discard this patch.