@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use DBAL\OldDbChangeSet; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
6 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
7 | 7 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'rpg_cost' => $rpg_cost, |
16 | 16 | )); |
17 | 17 | |
18 | -if(is_array($shipList)) { |
|
19 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
18 | +if (is_array($shipList)) { |
|
19 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
20 | 20 | $intError = MARKET_NO_DM; |
21 | 21 | } |
22 | 22 | |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | $qry = array(); |
34 | 34 | $total = array(); |
35 | 35 | $db_changeset = array(); |
36 | - foreach($shipList as $shipID => &$shipCount) { |
|
36 | + foreach ($shipList as $shipID => &$shipCount) { |
|
37 | 37 | $shipCount = ceil(floatval($shipCount)); |
38 | - if(!$shipCount) { |
|
38 | + if (!$shipCount) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
42 | - if($shipCount < 0) { |
|
42 | + if ($shipCount < 0) { |
|
43 | 43 | $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
44 | 44 | $intError = MARKET_NEGATIVE_SHIPS; |
45 | 45 | break; |
46 | 46 | } |
47 | 47 | |
48 | - if($mode == MARKET_SCRAPPER) { |
|
48 | + if ($mode == MARKET_SCRAPPER) { |
|
49 | 49 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
50 | - } elseif($mode == MARKET_STOCKMAN) { |
|
50 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
51 | 51 | $amount = $stock[$shipID]; |
52 | 52 | } |
53 | 53 | |
54 | - if($amount < $shipCount) { |
|
54 | + if ($amount < $shipCount) { |
|
55 | 55 | $intError = $error_no_stock; |
56 | 56 | break; |
57 | 57 | } |
58 | 58 | |
59 | - if(!in_array($shipID, sn_get_groups('fleet'))) { |
|
59 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
60 | 60 | $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
61 | 61 | $intError = MARKET_NOT_A_SHIP; |
62 | 62 | break; |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
73 | 73 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
74 | 74 | |
75 | - foreach($resTemp as $resID => $resCount) { |
|
75 | + foreach ($resTemp as $resID => $resCount) { |
|
76 | 76 | $total[$resID] += $resCount; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $message .= "<li>{$lang['tech'][$shipID]}: " . HelperString::numberFloorAndFormat($shipCount); |
80 | 80 | } |
81 | 81 | |
82 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
83 | - foreach($total as $resID => $resCount) { |
|
84 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
82 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
83 | + foreach ($total as $resID => $resCount) { |
|
84 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
85 | 85 | $intError = MARKET_NO_RESOURCES; |
86 | 86 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
87 | 87 | break; |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | |
92 | 92 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
93 | 93 | |
94 | - if($intError == MARKET_DEAL) { |
|
94 | + if ($intError == MARKET_DEAL) { |
|
95 | 95 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
96 | - foreach($total as $resID => $resCount) { |
|
97 | - if(!$resCount) { |
|
96 | + foreach ($total as $resID => $resCount) { |
|
97 | + if (!$resCount) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
@@ -128,38 +128,38 @@ discard block |
||
128 | 128 | 'MESSAGE' => $lang['eco_mrk_errors'][$intError], |
129 | 129 | )); |
130 | 130 | |
131 | - foreach($shipList as $shipID => $shipCount) { |
|
131 | + foreach ($shipList as $shipID => $shipCount) { |
|
132 | 132 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | $message = ''; |
137 | 137 | |
138 | -if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
138 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | tpl_set_resource_info($template, $planetrow, array()); |
143 | 143 | |
144 | -if(!$array) { |
|
144 | +if (!$array) { |
|
145 | 145 | $array = array(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | $group_fleet = sn_get_groups('fleet'); |
149 | -foreach($array as $key => $value) { |
|
150 | - if($mode == MARKET_SCRAPPER) { |
|
149 | +foreach ($array as $key => $value) { |
|
150 | + if ($mode == MARKET_SCRAPPER) { |
|
151 | 151 | $shipID = $value; |
152 | 152 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
153 | - } elseif($mode == MARKET_STOCKMAN) { |
|
153 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
154 | 154 | $shipID = $key; |
155 | 155 | $amount = $value; |
156 | 156 | } |
157 | 157 | |
158 | - if(!in_array($shipID, $group_fleet)) { |
|
158 | + if (!in_array($shipID, $group_fleet)) { |
|
159 | 159 | continue; |
160 | 160 | } |
161 | 161 | |
162 | - if($amount > 0) { |
|
162 | + if ($amount > 0) { |
|
163 | 163 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
164 | 164 | $template->assign_block_vars('ships', array( |
165 | 165 | 'ID' => $shipID, |
@@ -2,18 +2,18 @@ discard block |
||
2 | 2 | |
3 | 3 | use Planet\DBStaticPlanet; |
4 | 4 | |
5 | -if(SN_IN_FLEET !== true) { |
|
5 | +if (SN_IN_FLEET !== true) { |
|
6 | 6 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
9 | 9 | $fleetid = sys_get_param_id('fleetid'); |
10 | 10 | |
11 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
11 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
12 | 12 | sys_redirect("fleet.php"); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $fleet = db_fleet_get($fleetid); |
16 | -if(!$fleet) { |
|
16 | +if (!$fleet) { |
|
17 | 17 | messageBox($lang['fl_fleet_not_exists'], $lang['fl_error']); |
18 | 18 | } |
19 | 19 | //$query = doquery("SELECT * FROM `{{fleets}}` WHERE fleet_id = '{$fleetid}'"); |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | messageBox($lang['fl_isback'], $lang['fl_error']); |
28 | 28 | } |
29 | 29 | |
30 | -if($fleet['fleet_owner'] != $user['id']) { |
|
31 | - $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301); |
|
30 | +if ($fleet['fleet_owner'] != $user['id']) { |
|
31 | + $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
|
32 | 32 | messageBox($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']); |
33 | 33 | } |
34 | 34 | |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | |
39 | 39 | !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false; |
40 | 40 | |
41 | -if($userToAdd_unsafe) { |
|
41 | +if ($userToAdd_unsafe) { |
|
42 | 42 | $userToAdd = db_escape($userToAdd_unsafe); |
43 | 43 | $userToAddID = db_user_by_username($userToAdd_unsafe, true); |
44 | 44 | $userToAddID = $userToAddID['id']; |
45 | 45 | |
46 | - if($fleet['fleet_target_owner'] == $userToAddID) { |
|
46 | + if ($fleet['fleet_target_owner'] == $userToAddID) { |
|
47 | 47 | messageBox($lang['flt_aks_player_same'], $lang['fl_error']); |
48 | 48 | } |
49 | 49 | |
50 | - if($userToAddID) { |
|
51 | - if(!$aks) { |
|
50 | + if ($userToAddID) { |
|
51 | + if (!$aks) { |
|
52 | 52 | // No AСS exists - making one |
53 | - if(!$fleet['fleet_group']) { |
|
53 | + if (!$fleet['fleet_group']) { |
|
54 | 54 | doquery("INSERT INTO {{aks}} SET |
55 | 55 | `name` = '" . db_escape($lang['flt_acs_prefix'] . $fleetid) . "', |
56 | 56 | `teilnehmer` = '" . $user['id'] . "', |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | `planet` = '" . $fleet['fleet_end_planet'] . "', |
62 | 62 | `planet_type` = '" . $fleet['fleet_end_type'] . "', |
63 | 63 | `eingeladen` = '" . $user['id'] . "', |
64 | - `fleet_end_time` = '" . $fleet['fleet_end_time']. "'"); |
|
64 | + `fleet_end_time` = '" . $fleet['fleet_end_time'] . "'"); |
|
65 | 65 | |
66 | 66 | $aks = doquery("SELECT * FROM {{aks}} WHERE `flotten` = {$fleetid} LIMIT 1;", true); |
67 | 67 | |
@@ -79,26 +79,26 @@ discard block |
||
79 | 79 | |
80 | 80 | $isUserExists = false; |
81 | 81 | $invited_ar = explode(",", $aks['eingeladen']); |
82 | - foreach($invited_ar as $inv) { |
|
82 | + foreach ($invited_ar as $inv) { |
|
83 | 83 | if ($userToAddID == $inv) { |
84 | 84 | $isUserExists = true; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if(count($invited_ar) >= 5) { |
|
88 | + if (count($invited_ar) >= 5) { |
|
89 | 89 | messageBox($lang['flt_aks_error_too_much_players'], $lang['fl_error']); |
90 | 90 | } |
91 | 91 | |
92 | - if($isUserExists) { |
|
92 | + if ($isUserExists) { |
|
93 | 93 | $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf($lang['fl_aks_player_invited_already'], $userToAdd) : false; |
94 | 94 | } else { |
95 | 95 | $add_user_message_mr = sprintf($lang['fl_aks_player_invited'], $userToAdd); |
96 | 96 | doquery("UPDATE `{{aks}}` SET `eingeladen` = concat(`eingeladen`, ',{$userToAddID}') WHERE `flotten` = {$fleetid};") |
97 | - or die(sprintf($lang['fl_aks_adding_error'],db_error())); |
|
97 | + or die(sprintf($lang['fl_aks_adding_error'], db_error())); |
|
98 | 98 | $aks['eingeladen'] .= ',' . $userToAddID; |
99 | 99 | } |
100 | - msg_send_simple_message ( $userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
101 | - $lang['fl_aks_invite_message_header'], sprintf( $lang['fl_aks_invite_message'], $user['username'])); |
|
100 | + msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
101 | + $lang['fl_aks_invite_message_header'], sprintf($lang['fl_aks_invite_message'], $user['username'])); |
|
102 | 102 | } else { |
103 | 103 | $add_user_message_mr = sprintf($lang['fl_aks_player_error'], $userToAdd); |
104 | 104 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | 'MISSION_NAME' => $lang['type_mission'][MT_AKS], |
113 | 113 | )); |
114 | 114 | |
115 | -if($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
116 | - foreach($members as $row) { |
|
115 | +if ($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
116 | + foreach ($members as $row) { |
|
117 | 117 | $template->assign_block_vars('invited', array( |
118 | 118 | 'NAME' => $row['username'], |
119 | 119 | )); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $i++; |
124 | 124 | $fleet_row = db_fleet_get($fleetid); |
125 | 125 | |
126 | -if(is_array($fleet_row) && !empty($fleet_row)) { |
|
126 | +if (is_array($fleet_row) && !empty($fleet_row)) { |
|
127 | 127 | $planet_start = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_start_planet_id']); |
128 | 128 | $fleet_row['fleet_start_name'] = !empty($planet_start['name']) ? $planet_start['name'] : ''; |
129 | 129 | $planet_end = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_end_planet_id']); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
133 | 133 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
134 | -foreach($fleet_data['ships'] as $ship_data) { |
|
134 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
135 | 135 | $template->assign_block_vars('fleets.ships', $ship_data); |
136 | 136 | } |
137 | 137 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | |
11 | 11 | use Unit\DBStaticUnit; |
12 | 12 | |
13 | -define('INSIDE' , true); |
|
14 | -define('INSTALL' , false); |
|
13 | +define('INSIDE', true); |
|
14 | +define('INSTALL', false); |
|
15 | 15 | define('IN_ADMIN', true); |
16 | 16 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
17 | 17 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $template = gettemplate('admin/settings', true); |
23 | 23 | |
24 | -if(sys_get_param('save')) { |
|
24 | +if (sys_get_param('save')) { |
|
25 | 25 | SN::$config->game_name = sys_get_param_str_unsafe('game_name'); |
26 | 26 | SN::$config->game_mode = sys_get_param_int('game_mode'); |
27 | 27 | SN::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | SN::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
32 | 32 | SN::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
33 | 33 | SN::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
34 | - SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
34 | + SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
35 | 35 | SN::$config->game_disable = sys_get_param_int('game_disable'); |
36 | 36 | SN::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
37 | 37 | SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | SN::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
102 | 102 | |
103 | 103 | SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
104 | - if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
105 | - if(SN::$config->empire_mercenary_temporary) { |
|
104 | + if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
105 | + if (SN::$config->empire_mercenary_temporary) { |
|
106 | 106 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
107 | 107 | } else { |
108 | 108 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | tpl_assign_select($template, 'ver_response', SN::$lang['adm_opt_ver_response'], 'ID', 'NAME'); |
153 | 153 | |
154 | 154 | $lang_list = lng_get_list(); |
155 | -foreach($lang_list as $lang_id => $lang_data) { |
|
155 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
156 | 156 | $template->assign_block_vars('game_languages', array( |
157 | 157 | 'ID' => $lang_id, |
158 | 158 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ORDER BY `message_time` DESC;"; |
329 | 329 | } |
330 | 330 | |
331 | - if($this->showAll) { |
|
331 | + if ($this->showAll) { |
|
332 | 332 | $message_query = $this->db->selectIterator($message_query); |
333 | 333 | } else { |
334 | 334 | $message_query = new DbSqlPaging($message_query, PAGING_PAGE_SIZE_DEFAULT_MESSAGES, sys_get_param_int(PagingRenderer::KEYWORD)); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $this->mode = sys_get_param_str('msg_delete') ? static::MESSAGES_MODE_DELETE : sys_get_param_str('mode'); |
484 | 484 | } |
485 | 485 | |
486 | - if($this->showAll = sys_get_param_str('msg_show_all') ? true : false) { |
|
486 | + if ($this->showAll = sys_get_param_str('msg_show_all') ? true : false) { |
|
487 | 487 | $this->mode = static::MESSAGES_MODE_MESSAGES; |
488 | 488 | } |
489 | 489 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | $this->addFirstLast(); |
115 | 115 | } |
116 | 116 | |
117 | - if(!empty($this->result)) { |
|
117 | + if (!empty($this->result)) { |
|
118 | 118 | $template = gettemplate('_paging'); |
119 | 119 | $template->assign_recursive([ |
120 | 120 | 'PAGING_ROOT' => $this->rootUrl, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | - if(!empty($paramList)) { |
|
22 | + if (!empty($paramList)) { |
|
23 | 23 | $strParams = implode('&', $paramList); |
24 | 24 | } |
25 | 25 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | * @author Fabien Potencier |
33 | 33 | * @author Dominik Zogg |
34 | 34 | */ |
35 | -interface ServiceProviderInterface |
|
36 | -{ |
|
35 | +interface ServiceProviderInterface { |
|
37 | 36 | /** |
38 | 37 | * Registers services on the given container. |
39 | 38 | * |
@@ -239,7 +239,7 @@ |
||
239 | 239 | |
240 | 240 | $factory = $this->values[$id]; |
241 | 241 | |
242 | - $extended = function ($c) use ($callable, $factory) { |
|
242 | + $extended = function($c) use ($callable, $factory) { |
|
243 | 243 | return $callable($factory($c), $c); |
244 | 244 | }; |
245 | 245 |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @author Fabien Potencier |
33 | 33 | */ |
34 | -class Container implements \ArrayAccess |
|
35 | -{ |
|
34 | +class Container implements \ArrayAccess { |
|
36 | 35 | private $values = array(); |
37 | 36 | private $factories; |
38 | 37 | private $protected; |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * |
48 | 47 | * @param array $values The parameters or objects. |
49 | 48 | */ |
50 | - public function __construct(array $values = array()) |
|
51 | - { |
|
49 | + public function __construct(array $values = array()) { |
|
52 | 50 | $this->factories = new \SplObjectStorage(); |
53 | 51 | $this->protected = new \SplObjectStorage(); |
54 | 52 | |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | * |
72 | 70 | * @throws \RuntimeException Prevent override of a frozen service |
73 | 71 | */ |
74 | - public function offsetSet($id, $value) |
|
75 | - { |
|
72 | + public function offsetSet($id, $value) { |
|
76 | 73 | if (isset($this->frozen[$id])) { |
77 | 74 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
78 | 75 | } |
@@ -90,8 +87,7 @@ discard block |
||
90 | 87 | * |
91 | 88 | * @throws \InvalidArgumentException if the identifier is not defined |
92 | 89 | */ |
93 | - public function offsetGet($id) |
|
94 | - { |
|
90 | + public function offsetGet($id) { |
|
95 | 91 | if (!isset($this->keys[$id])) { |
96 | 92 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
97 | 93 | } |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | * |
126 | 122 | * @return bool |
127 | 123 | */ |
128 | - public function offsetExists($id) |
|
129 | - { |
|
124 | + public function offsetExists($id) { |
|
130 | 125 | return isset($this->keys[$id]); |
131 | 126 | } |
132 | 127 | |
@@ -135,8 +130,7 @@ discard block |
||
135 | 130 | * |
136 | 131 | * @param string $id The unique identifier for the parameter or object |
137 | 132 | */ |
138 | - public function offsetUnset($id) |
|
139 | - { |
|
133 | + public function offsetUnset($id) { |
|
140 | 134 | if (isset($this->keys[$id])) { |
141 | 135 | if (is_object($this->values[$id])) { |
142 | 136 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +149,7 @@ discard block |
||
155 | 149 | * |
156 | 150 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
157 | 151 | */ |
158 | - public function factory($callable) |
|
159 | - { |
|
152 | + public function factory($callable) { |
|
160 | 153 | if (!method_exists($callable, '__invoke')) { |
161 | 154 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
162 | 155 | } |
@@ -177,8 +170,7 @@ discard block |
||
177 | 170 | * |
178 | 171 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
179 | 172 | */ |
180 | - public function protect($callable) |
|
181 | - { |
|
173 | + public function protect($callable) { |
|
182 | 174 | if (!method_exists($callable, '__invoke')) { |
183 | 175 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
184 | 176 | } |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * |
198 | 190 | * @throws \InvalidArgumentException if the identifier is not defined |
199 | 191 | */ |
200 | - public function raw($id) |
|
201 | - { |
|
192 | + public function raw($id) { |
|
202 | 193 | if (!isset($this->keys[$id])) { |
203 | 194 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
204 | 195 | } |
@@ -223,8 +214,7 @@ discard block |
||
223 | 214 | * |
224 | 215 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
225 | 216 | */ |
226 | - public function extend($id, $callable) |
|
227 | - { |
|
217 | + public function extend($id, $callable) { |
|
228 | 218 | if (!isset($this->keys[$id])) { |
229 | 219 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
230 | 220 | } |
@@ -256,8 +246,7 @@ discard block |
||
256 | 246 | * |
257 | 247 | * @return array An array of value names |
258 | 248 | */ |
259 | - public function keys() |
|
260 | - { |
|
249 | + public function keys() { |
|
261 | 250 | return array_keys($this->values); |
262 | 251 | } |
263 | 252 | |
@@ -269,8 +258,7 @@ discard block |
||
269 | 258 | * |
270 | 259 | * @return static |
271 | 260 | */ |
272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
273 | - { |
|
261 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
274 | 262 | $provider->register($this); |
275 | 263 | |
276 | 264 | foreach ($values as $key => $value) { |
@@ -89,91 +89,91 @@ |
||
89 | 89 | |
90 | 90 | // Services -------------------------------------------------------------------------------------------------------- |
91 | 91 | // Default db |
92 | - $gc->db = function (GlobalContainer $c) { |
|
92 | + $gc->db = function(GlobalContainer $c) { |
|
93 | 93 | SN::$db = new \DBAL\db_mysql($c); |
94 | 94 | |
95 | 95 | return SN::$db; |
96 | 96 | }; |
97 | 97 | |
98 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
98 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
99 | 99 | GlobalContainer $c) { |
100 | 100 | return new \debug(); |
101 | 101 | }; |
102 | 102 | |
103 | - $gc->cache = function (GlobalContainer $gc) { |
|
103 | + $gc->cache = function(GlobalContainer $gc) { |
|
104 | 104 | return new \classCache($gc->cachePrefix); |
105 | 105 | }; |
106 | 106 | |
107 | - $gc->config = function (GlobalContainer $gc) { |
|
107 | + $gc->config = function(GlobalContainer $gc) { |
|
108 | 108 | return new \classConfig($gc->cachePrefix); |
109 | 109 | }; |
110 | 110 | |
111 | 111 | |
112 | - $gc->repository = function (GlobalContainer $gc) { |
|
112 | + $gc->repository = function(GlobalContainer $gc) { |
|
113 | 113 | return new Repository($gc); |
114 | 114 | }; |
115 | 115 | |
116 | - $gc->storage = function (GlobalContainer $gc) { |
|
116 | + $gc->storage = function(GlobalContainer $gc) { |
|
117 | 117 | return new \Storage($gc); |
118 | 118 | }; |
119 | 119 | |
120 | - $gc->design = function (GlobalContainer $gc) { |
|
120 | + $gc->design = function(GlobalContainer $gc) { |
|
121 | 121 | return new \Design($gc); |
122 | 122 | }; |
123 | 123 | |
124 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
124 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
125 | 125 | return new \BBCodeParser($gc); |
126 | 126 | }; |
127 | 127 | |
128 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
128 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
129 | 129 | return new \Fleet\FleetDispatcher($gc); |
130 | 130 | }; |
131 | 131 | |
132 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
132 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
133 | 133 | return new Watchdog($gc); |
134 | 134 | }; |
135 | 135 | |
136 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
136 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
137 | 137 | return new ValueStorage([]); |
138 | 138 | }; |
139 | 139 | |
140 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
140 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
141 | 141 | return new BonusCatalog($gc); |
142 | 142 | }; |
143 | 143 | |
144 | - $gc->general = function (GlobalContainer $gc) { |
|
144 | + $gc->general = function(GlobalContainer $gc) { |
|
145 | 145 | return new General($gc); |
146 | 146 | }; |
147 | 147 | |
148 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
148 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
149 | 149 | return new EconomicHelper($gc); |
150 | 150 | }; |
151 | 151 | |
152 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
152 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
153 | 153 | return new PlayerLevelHelper($gc); |
154 | 154 | }; |
155 | 155 | |
156 | - $gc->pimp = function (GlobalContainer $gc) { |
|
156 | + $gc->pimp = function(GlobalContainer $gc) { |
|
157 | 157 | return new SnPimp($gc); |
158 | 158 | }; |
159 | 159 | |
160 | - $gc->modules = function (GlobalContainer $gc) { |
|
160 | + $gc->modules = function(GlobalContainer $gc) { |
|
161 | 161 | return new ModulesManager($gc); |
162 | 162 | }; |
163 | 163 | |
164 | 164 | // Dummy objects --------------------------------------------------------------------------------------------------- |
165 | - $gc->theUser = function (GlobalContainer $gc) { |
|
165 | + $gc->theUser = function(GlobalContainer $gc) { |
|
166 | 166 | return new \TheUser($gc); |
167 | 167 | }; |
168 | 168 | |
169 | 169 | |
170 | 170 | // Models ---------------------------------------------------------------------------------------------------------- |
171 | 171 | $gc->skinEntityClass = \SkinV2::class; |
172 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
172 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
173 | 173 | return new \SkinModel($gc); |
174 | 174 | }; |
175 | 175 | |
176 | - $gc->textModel = function (GlobalContainer $gc) { |
|
176 | + $gc->textModel = function(GlobalContainer $gc) { |
|
177 | 177 | return new \TextModel($gc); |
178 | 178 | }; |
179 | 179 |