@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @return mixed |
| 14 | 14 | * @deprecated |
| 15 | 15 | */ |
| 16 | -function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));} |
|
| 16 | +function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); } |
|
| 17 | 17 | /** |
| 18 | 18 | * @param array $fleet_row |
| 19 | 19 | * @param bool $start |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @return array |
| 241 | 241 | */ |
| 242 | 242 | public static function parseParamStrings($array, $delimiter = '=') { |
| 243 | - !is_array($array) ? $array = array((string)$array) : false; |
|
| 243 | + !is_array($array) ? $array = array((string) $array) : false; |
|
| 244 | 244 | |
| 245 | 245 | $result = array(); |
| 246 | 246 | foreach ($array as $param) { |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | * @return float|null |
| 263 | 263 | */ |
| 264 | 264 | public static function maxValueByField(&$array, $fieldName) { |
| 265 | - return array_reduce($array, function ($carry, $item) use ($fieldName) { |
|
| 266 | - if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) { |
|
| 265 | + return array_reduce($array, function($carry, $item) use ($fieldName) { |
|
| 266 | + if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) { |
|
| 267 | 267 | $carry = $item[$fieldName]; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | return |
| 282 | 282 | array_reduce($array, |
| 283 | - function ($carry, $item) use (&$fieldName, $maxValue) { |
|
| 284 | - if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) { |
|
| 283 | + function($carry, $item) use (&$fieldName, $maxValue) { |
|
| 284 | + if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) { |
|
| 285 | 285 | $carry[] = $item; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | public static function intersectByKeys(array &$array1, array &$array2) { |
| 295 | - return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;}); |
|
| 295 | + return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; }); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | } |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | public function get($entityClass, $id) { |
| 88 | 88 | $entityIndex = get_class($entityClass) . '\\' . $id; |
| 89 | - if(!isset($this->_repository[$entityIndex])) { |
|
| 89 | + if (!isset($this->_repository[$entityIndex])) { |
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $config->pass()->game_disable = GAME_DISABLE_STAT; |
| 59 | 59 | |
| 60 | 60 | $statMinimalInterval = intval($config->pass()->stats_minimal_interval); |
| 61 | - $config->pass()->var_stat_update_end= date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
| 61 | + $config->pass()->var_stat_update_end = date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
| 62 | 62 | $config->pass()->var_stat_update_msg = 'Update started'; |
| 63 | 63 | sn_db_transaction_commit(); |
| 64 | 64 | |
@@ -22,11 +22,11 @@ |
||
| 22 | 22 | |
| 23 | 23 | define('IN_AJAX', true); |
| 24 | 24 | |
| 25 | -if(($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) { |
|
| 25 | +if (($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) { |
|
| 26 | 26 | $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8'); |
| 27 | 27 | print(json_encode($result)); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -if(!defined('IN_ADMIN')) { |
|
| 30 | +if (!defined('IN_ADMIN')) { |
|
| 31 | 31 | die(); |
| 32 | 32 | } |
@@ -75,11 +75,11 @@ |
||
| 75 | 75 | * @return float[] - [int resourceId] -> [float ratesNormalizedToResourceCost] |
| 76 | 76 | */ |
| 77 | 77 | public function getResourceExchangeIn($resourceId) { |
| 78 | - if(empty($this->resourceExchangeRates[$resourceId])) { |
|
| 78 | + if (empty($this->resourceExchangeRates[$resourceId])) { |
|
| 79 | 79 | $defaultRates = $this->getResourcesExchange(); |
| 80 | 80 | |
| 81 | 81 | $this->resourceExchangeRates[$resourceId] = []; |
| 82 | - foreach($defaultRates as $defaultResourceId => $defaultRate) { |
|
| 82 | + foreach ($defaultRates as $defaultResourceId => $defaultRate) { |
|
| 83 | 83 | $this->resourceExchangeRates[$resourceId][$defaultResourceId] = $defaultRate / $defaultRates[$resourceId]; |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
|
| 3 | +function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); } |
|
| 4 | 4 | function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
| 5 | 5 | { |
| 6 | 6 | global $lang; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | return $mode; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
|
| 22 | +function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); } |
|
| 23 | 23 | /** |
| 24 | 24 | * @param template $template |
| 25 | 25 | * @param $edit_planet_row |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | global $lang; |
| 31 | 31 | |
| 32 | 32 | $unit_list = sn_get_groups($mode); |
| 33 | - if(empty($unit_list)) |
|
| 33 | + if (empty($unit_list)) |
|
| 34 | 34 | { |
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | $name_list = $lang['tech']; |
| 38 | 38 | |
| 39 | - foreach($unit_list as $unit_id) |
|
| 39 | + foreach ($unit_list as $unit_id) |
|
| 40 | 40 | { |
| 41 | 41 | $template->assign_block_vars('unit', array( |
| 42 | 42 | 'ID' => $unit_id, |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
|
| 50 | +function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); } |
|
| 51 | 51 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
| 52 | 52 | { |
| 53 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 53 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 54 | 54 | { |
| 55 | 55 | $unit_amount = round($unit_amount); |
| 56 | 56 | $unit_name = get_unit_param($unit_id, P_NAME); |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | global $who, $lang; |
| 12 | 12 | |
| 13 | 13 | // $sn_group_stat_common = sn_get_groups('STAT_COMMON'); |
| 14 | - foreach($array as $key => $value) { |
|
| 15 | - if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
| 14 | + foreach ($array as $key => $value) { |
|
| 15 | + if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
| 16 | 16 | continue; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $subject_list = array( |
| 45 | 45 | 1 => array('header' => $lang['stat_player']), |
| 46 | 46 | ); |
| 47 | -if(!$source) { |
|
| 47 | +if (!$source) { |
|
| 48 | 48 | $subject_list[2] = array('header' => $lang['stat_allys']); |
| 49 | 49 | } |
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $page_count = floor($record_count / 100); |
| 113 | 113 | $pages = array(); |
| 114 | -for($i = 0; $i <= $page_count; $i++) { |
|
| 114 | +for ($i = 0; $i <= $page_count; $i++) { |
|
| 115 | 115 | $first_element = $i * 100 + 1; |
| 116 | 116 | $last_element = $first_element + 99; |
| 117 | 117 | $pages[$first_element] = array( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'POINTS' => HelperString::numberFloorAndFormat($row['points']), |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | - if($who == 1) { |
|
| 133 | + if ($who == 1) { |
|
| 134 | 134 | $row_stat['ALLY_NAME'] = $row['ally_name']; |
| 135 | 135 | $row_stat['ALLY_ID'] = $row['ally_id']; |
| 136 | 136 | empty($row['username']) ? $row['username'] = $row['name'] : false; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | public function unset_by_prefix($prefix_unset = '') { |
| 152 | 152 | static $array_clear; |
| 153 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
| 153 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
| 154 | 154 | strpos($k, $p) === 0 ? $v = null : false; |
| 155 | 155 | } : false; |
| 156 | 156 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | if ($this->$name[0] === null) { |
| 206 | 206 | for ($i = count($name) - 1; $i > 0; $i--) { |
| 207 | 207 | $cName = "{$name[$i]}_COUNT"; |
| 208 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 208 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 209 | 209 | if ($this->$cName1 == null || $i == 1) { |
| 210 | 210 | $this->$cName++; |
| 211 | 211 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $count = count($name); |
| 252 | 252 | for ($i = 1; $i < $count; $i++) { |
| 253 | 253 | $cName = "{$name[$i]}_COUNT"; |
| 254 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 254 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 255 | 255 | |
| 256 | 256 | if ($i == 1 || $this->$cName1 === null) { |
| 257 | 257 | $this->$cName--; |