Test Failed
Push — trunk ( b3f953...fb036a )
by SuperNova.WS
05:47
created
classes/debug.php 2 patches
Spacing   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
       $filtered = array_slice($filtered, -$onlyLastX);
157 157
     }
158 158
 
159
-    return [$raw, $filtered,];
159
+    return [$raw, $filtered, ];
160 160
   }
161 161
 
162 162
   /**
@@ -235,8 +235,7 @@  discard block
 block discarded – undo
235 235
       foreach ($error_backtrace['cSN_data'] as &$location) {
236 236
         foreach ($location as $location_id => &$location_data) //          $location_data = $location_id;
237 237
         {
238
-          $location_data = isset($location_data['username']) ? $location_data['username'] :
239
-            (isset($location_data['name']) ? $location_data['name'] : $location_id);
238
+          $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id);
240 239
         }
241 240
       }
242 241
     }
@@ -405,16 +404,16 @@  discard block
 block discarded – undo
405 404
     $dumper = mt_rand(10, 99) . '|' . $varname;
406 405
   }
407 406
 
408
-  $type   = gettype($value);
407
+  $type = gettype($value);
409 408
   $dumper .= $type;
410 409
 
411 410
   if ($type == 'string') {
412 411
     $dumper .= '(' . strlen($value) . ')';
413
-    $value  = dump($value, '', -1);
412
+    $value = dump($value, '', -1);
414 413
   } elseif ($type == 'boolean') {
415 414
     $value = ($value ? 'true' : 'false');
416 415
   } elseif ($type == 'object') {
417
-    $props  = get_class_vars(get_class($value));
416
+    $props = get_class_vars(get_class($value));
418 417
     $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
419 418
     foreach ($props as $key => $val) {
420 419
       $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => ';
@@ -524,12 +523,9 @@  discard block
 block discarded – undo
524 523
     foreach (func_get_args() ?: [] as $var) {
525 524
       print "<pre>";
526 525
       print_r(
527
-        $var === null ? 'null' :
528
-          (($type = gettype($var)) == 'object' || $type == 'array'
529
-            ? $var :
530
-            ($type === 'string'
531
-              ? $type . '(' . strlen($var) . ') `' . $var . '`' :
532
-              ($type == 'boolean'
526
+        $var === null ? 'null' : (($type = gettype($var)) == 'object' || $type == 'array'
527
+            ? $var : ($type === 'string'
528
+              ? $type . '(' . strlen($var) . ') `' . $var . '`' : ($type == 'boolean'
533 529
                 ? ($var ? 'true' : 'false')
534 530
                 : $type . ' ' . print_r($var, true)
535 531
               )
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -233,11 +233,13 @@
 block discarded – undo
233 233
     if ($deadlock && ($q = SN::$db->mysql_get_innodb_status())) {
234 234
       $error_backtrace['deadlock'] = explode("\n", $q['Status']);
235 235
       foreach ($error_backtrace['cSN_data'] as &$location) {
236
-        foreach ($location as $location_id => &$location_data) //          $location_data = $location_id;
236
+        foreach ($location as $location_id => &$location_data) {
237
+          //          $location_data = $location_id;
237 238
         {
238 239
           $location_data = isset($location_data['username']) ? $location_data['username'] :
239 240
             (isset($location_data['name']) ? $location_data['name'] : $location_id);
240 241
         }
242
+        }
241 243
       }
242 244
     }
243 245
 
Please login to merge, or discard this patch.
classes/Player/PlayerStatic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 
62 62
     if (!empty($TheUser['ally_id'])) {
63 63
       /** @noinspection SqlResolve */
64
-      $TheAlly                 = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true);
64
+      $TheAlly = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true);
65 65
       $TheAlly['ally_members'] -= 1;
66 66
       /** @noinspection SqlResolve */
67 67
       doquery("UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
Please login to merge, or discard this patch.
classes/BanHammer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
    * @return array[]|object[]
25 25
    */
26 26
   public static function getByIpV4($ipV4, $isExpired = self::EXPIRED_NOT) {
27
-    $ipV4 = !is_numeric($ipV4) ? ip2long($ipV4) : (integer)$ipV4;
27
+    $ipV4 = !is_numeric($ipV4) ? ip2long($ipV4) : (integer) $ipV4;
28 28
 
29 29
     $sqlArray = [
30 30
       "SELECT *, INET_NTOA(`ipv4_from`) as ipv4_from_string, INET_NTOA(`ipv4_to`) as ipv4_to_string
Please login to merge, or discard this patch.
classes/SnTemplate.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $insert_position = $is_positioned == '-' ? 0 : count($menu);
129 129
       }
130 130
 
131
-      $insert_position     += $is_positioned == '+' ? 1 : 0;
131
+      $insert_position += $is_positioned == '+' ? 1 : 0;
132 132
       $spliced             = array_splice($menu, $insert_position, count($menu) - $insert_position);
133 133
       $menu[$menu_item_id] = $menu_item;
134 134
 
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
       $cssOriginal = $css;
437 437
 
438 438
       // At first - removing minimization flag from file name
439
-      if(($rPos = strrpos($css, '.min.css')) !== false) {
439
+      if (($rPos = strrpos($css, '.min.css')) !== false) {
440 440
         // 4 - string length of substring to cut `.min`
441 441
         $css = substr_replace($css, '', $rPos, 4);
442 442
       }
443 443
       // Also we don't need `.css` extension
444
-      if(($rPos = strrpos($css, '.css')) !== false) {
444
+      if (($rPos = strrpos($css, '.css')) !== false) {
445 445
         // 4 - string length of substring to cut `.css`
446 446
         $css = substr_replace($css, '', $rPos, 4);
447 447
       }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
       $cssWas = count($standard_css);
451 451
       // Trying to add newly found filename
452 452
       $standard_css = self::addFileName($css, $standard_css);
453
-      if(count($standard_css) > $cssWas) {
453
+      if (count($standard_css) > $cssWas) {
454 454
         // Removing file from extra CSS list only if everything went well and records was added to list of CSS to cache
455 455
         // Otherwise something went wrong - so we don't touch this
456 456
         unset($sn_mvc['css'][''][$cssOriginal]);
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
    * @return array
570 570
    */
571 571
   public static function addFileName($fileNames, $anArray, $ext = '.css') {
572
-    if(!is_array($fileNames)) {
572
+    if (!is_array($fileNames)) {
573 573
       $fileNames = [$fileNames];
574 574
     }
575 575
 
576
-    foreach($fileNames as $fileName) {
576
+    foreach ($fileNames as $fileName) {
577 577
       if (file_exists(SN_ROOT_PHYSICAL . $fileName . '.min' . $ext)) {
578 578
         $anArray[$fileName . '.min' . $ext] = '';
579 579
       } elseif (file_exists(SN_ROOT_PHYSICAL . $fileName . '.css' . $ext)) {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
       'LANG'     => $language ? $language : '',
705 705
       'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
706 706
 
707
-      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
707
+      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
708 708
       'FILENAME'       => basename($_SERVER['PHP_SELF']),
709 709
     ));
710 710
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
       'QUE_ID'   => QUE_RESEARCH,
938 938
       'QUE_HTML' => 'topnav',
939 939
 
940
-      'RESEARCH_ONGOING' => (boolean)$user['que'],
940
+      'RESEARCH_ONGOING' => (boolean) $user['que'],
941 941
 
942 942
       'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
943 943
         $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
       SnTemplate::renderFooter($page, $template_result);
1232 1232
     }
1233 1233
 
1234
-    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
1234
+    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
1235 1235
 
1236 1236
     SN::$db->db_disconnect();
1237 1237
 
Please login to merge, or discard this patch.
classes/SN.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -261,11 +261,13 @@  discard block
 block discarded – undo
261 261
     $location_info = &static::$location_info[$location_type];
262 262
     $id_field      = $location_info[P_ID];
263 263
     $table_name    = $location_info[P_TABLE_NAME];
264
-    if ($result = self::$db->doquery("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}", false)) // TODO Как-то вернуть может быть LIMIT 1 ?
264
+    if ($result = self::$db->doquery("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}", false)) {
265
+      // TODO Как-то вернуть может быть LIMIT 1 ?
265 266
     {
266 267
       if (static::$db->db_affected_rows()) {
267 268
         // Обновляем данные только если ряд был затронут
268 269
         DBStaticUnit::cache_clear();
270
+    }
269 271
       }
270 272
     }
271 273
 
@@ -295,9 +297,11 @@  discard block
 block discarded – undo
295 297
     $set        = trim($set);
296 298
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
297 299
     if ($result = self::$db->doquery("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
298
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
300
+      if (static::$db->db_affected_rows()) {
301
+        // Обновляем данные только если ряд был затронут
299 302
       {
300 303
         $record_id = SN::$db->db_insert_id();
304
+      }
301 305
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
302 306
         $result = static::db_get_record_by_id($location_type, $record_id);
303 307
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -317,10 +321,12 @@  discard block
 block discarded – undo
317 321
     $id_field      = $location_info[P_ID];
318 322
     $table_name    = $location_info[P_TABLE_NAME];
319 323
     if ($result = self::$db->doquery("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) {
320
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
324
+      if (static::$db->db_affected_rows()) {
325
+        // Обновляем данные только если ряд был затронут
321 326
       {
322 327
         DBStaticUnit::cache_clear();
323 328
       }
329
+      }
324 330
     }
325 331
 
326 332
     return $result;
@@ -334,11 +340,13 @@  discard block
 block discarded – undo
334 340
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
335 341
 
336 342
     if ($result = self::$db->doquery("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) {
337
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
343
+      if (static::$db->db_affected_rows()) {
344
+        // Обновляем данные только если ряд был затронут
338 345
       {
339 346
         // Обнуление кэша, потому что непонятно, что поменялось
340 347
         DBStaticUnit::cache_clear();
341 348
       }
349
+      }
342 350
     }
343 351
 
344 352
     return $result;
Please login to merge, or discard this patch.
classes/Planet/DBStaticPlanet.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
     $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0;
38 38
     $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0;
39 39
     $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0;
40
-    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) :
41
-      (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
40
+    $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
42 41
     $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type;
43 42
 
44 43
     return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type);
Please login to merge, or discard this patch.
classes/Core/Autoloader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
   protected static $autoloaderRegistered = false;
25 25
 
26 26
   protected static function _constructorStatic() {
27
-    if(!static::$autoloaderRegistered) {
27
+    if (!static::$autoloaderRegistered) {
28 28
       spl_autoload_register(array(__CLASS__, 'autoloader'));
29 29
       static::$autoloaderRegistered = true;
30 30
     }
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
   public static function autoloader($class) {
37 37
     static::_constructorStatic();
38 38
 
39
-    foreach(static::$folders as $data) {
39
+    foreach (static::$folders as $data) {
40 40
       $theClassFile = $class;
41 41
 
42
-      if($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) {
42
+      if ($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) {
43 43
         $theClassFile = substr($class, strlen($data[static::P_PREFIX]));
44 44
       }
45 45
 
46 46
       $classFullFileName = str_replace('\\', '/', $data[static::P_FOLDER] . $theClassFile) . DOT_PHP_EX;
47
-      if(file_exists($classFullFileName) && is_file($classFullFileName)) {
47
+      if (file_exists($classFullFileName) && is_file($classFullFileName)) {
48 48
         require_once($classFullFileName);
49
-        if(method_exists($class, '_constructorStatic')) {
49
+        if (method_exists($class, '_constructorStatic')) {
50 50
           $class::_constructorStatic();
51 51
         }
52 52
       }
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
     $absoluteClassRoot = str_replace('\\', '/', SN_ROOT_PHYSICAL . $absoluteClassRoot);
64 64
 
65
-    if(!($absoluteClassRoot = realpath($absoluteClassRoot))) {
65
+    if (!($absoluteClassRoot = realpath($absoluteClassRoot))) {
66 66
       // TODO - throw new \Exception("There is some error when installing autoloader for '{$absoluteClassRoot}' class prefix '{$classPrefix}'");
67 67
       return;
68 68
     }
69 69
     $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/';
70 70
 
71
-    if($classPrefix && substr($classPrefix, -1) != '\\') {
71
+    if ($classPrefix && substr($classPrefix, -1) != '\\') {
72 72
       $classPrefix .= '\\';
73 73
     }
74 74
 
Please login to merge, or discard this patch.
classes/Core/Updater.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
    * @return bool|mysqli_result|null
207 207
    */
208 208
   public function indexDropIfExists($table, $index) {
209
-    return $this->upd_alter_table($table, ["DROP KEY `{$index}`",], $this->isIndexExists($table, $index));
209
+    return $this->upd_alter_table($table, ["DROP KEY `{$index}`", ], $this->isIndexExists($table, $index));
210 210
   }
211 211
 
212 212
   /**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
    * @return bool|mysqli_result|null
217 217
    */
218 218
   public function constraintDropIfExists($table, $constraint) {
219
-    return $this->upd_alter_table($table, ["DROP FOREIGN KEY `{$constraint}`",], $this->isConstrainExists($table, $constraint));
219
+    return $this->upd_alter_table($table, ["DROP FOREIGN KEY `{$constraint}`", ], $this->isConstrainExists($table, $constraint));
220 220
   }
221 221
 
222 222
   /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 
241 241
     $this->indexDropIfExists($table, $index);
242
-    $queryFields = implode(',', array_map(function ($value) { return "`{$value}`"; }, $fields));
242
+    $queryFields = implode(',', array_map(function($value) { return "`{$value}`"; }, $fields));
243 243
     if ($queryFields) {
244 244
       $this->upd_alter_table(
245 245
         $table,
Please login to merge, or discard this patch.
classes/Core/SnBootstrap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 class SnBootstrap {
14 14
 
15 15
   public static function install_benchmark() {
16
-    register_shutdown_function(function () {
16
+    register_shutdown_function(function() {
17 17
       if (defined('IN_AJAX')) {
18 18
         return;
19 19
       }
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
     // Declaring PHP-constants from server config
104 104
     /** @see \classConfig::$DEBUG_SQL_FILE_LOG */
105 105
     foreach ([
106
-      'DEBUG_SQL_FILE_LOG'     => ['DEBUG_SQL_ERROR' => true, 'DEBUG_SQL_COMMENT_LONG' => true,],
107
-      'DEBUG_SQL_ERROR'        => ['DEBUG_SQL_COMMENT' => true,],
108
-      'DEBUG_SQL_COMMENT_LONG' => ['DEBUG_SQL_COMMENT' => true,],
106
+      'DEBUG_SQL_FILE_LOG'     => ['DEBUG_SQL_ERROR' => true, 'DEBUG_SQL_COMMENT_LONG' => true, ],
107
+      'DEBUG_SQL_ERROR'        => ['DEBUG_SQL_COMMENT' => true, ],
108
+      'DEBUG_SQL_COMMENT_LONG' => ['DEBUG_SQL_COMMENT' => true, ],
109 109
       'DEBUG_SQL_COMMENT'      => []
110 110
     ] as $constantName => $implications) {
111 111
       if (!empty(SN::$config->$constantName) && !defined($constantName)) {
Please login to merge, or discard this patch.