@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param array $values The parameters or objects. |
49 | 49 | */ |
50 | - public function __construct(array $values = array()) |
|
51 | - { |
|
50 | + public function __construct(array $values = array()) { |
|
52 | 51 | $this->factories = new \SplObjectStorage(); |
53 | 52 | $this->protected = new \SplObjectStorage(); |
54 | 53 | |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * |
72 | 71 | * @throws \RuntimeException Prevent override of a frozen service |
73 | 72 | */ |
74 | - public function offsetSet($id, $value) |
|
75 | - { |
|
73 | + public function offsetSet($id, $value) { |
|
76 | 74 | if (isset($this->frozen[$id])) { |
77 | 75 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
78 | 76 | } |
@@ -90,8 +88,7 @@ discard block |
||
90 | 88 | * |
91 | 89 | * @throws \InvalidArgumentException if the identifier is not defined |
92 | 90 | */ |
93 | - public function offsetGet($id) |
|
94 | - { |
|
91 | + public function offsetGet($id) { |
|
95 | 92 | if (!isset($this->keys[$id])) { |
96 | 93 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
97 | 94 | } |
@@ -125,8 +122,7 @@ discard block |
||
125 | 122 | * |
126 | 123 | * @return bool |
127 | 124 | */ |
128 | - public function offsetExists($id) |
|
129 | - { |
|
125 | + public function offsetExists($id) { |
|
130 | 126 | return isset($this->keys[$id]); |
131 | 127 | } |
132 | 128 | |
@@ -135,8 +131,7 @@ discard block |
||
135 | 131 | * |
136 | 132 | * @param string $id The unique identifier for the parameter or object |
137 | 133 | */ |
138 | - public function offsetUnset($id) |
|
139 | - { |
|
134 | + public function offsetUnset($id) { |
|
140 | 135 | if (isset($this->keys[$id])) { |
141 | 136 | if (is_object($this->values[$id])) { |
142 | 137 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +150,7 @@ discard block |
||
155 | 150 | * |
156 | 151 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
157 | 152 | */ |
158 | - public function factory($callable) |
|
159 | - { |
|
153 | + public function factory($callable) { |
|
160 | 154 | if (!method_exists($callable, '__invoke')) { |
161 | 155 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
162 | 156 | } |
@@ -177,8 +171,7 @@ discard block |
||
177 | 171 | * |
178 | 172 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
179 | 173 | */ |
180 | - public function protect($callable) |
|
181 | - { |
|
174 | + public function protect($callable) { |
|
182 | 175 | if (!method_exists($callable, '__invoke')) { |
183 | 176 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
184 | 177 | } |
@@ -197,8 +190,7 @@ discard block |
||
197 | 190 | * |
198 | 191 | * @throws \InvalidArgumentException if the identifier is not defined |
199 | 192 | */ |
200 | - public function raw($id) |
|
201 | - { |
|
193 | + public function raw($id) { |
|
202 | 194 | if (!isset($this->keys[$id])) { |
203 | 195 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
204 | 196 | } |
@@ -223,8 +215,7 @@ discard block |
||
223 | 215 | * |
224 | 216 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
225 | 217 | */ |
226 | - public function extend($id, $callable) |
|
227 | - { |
|
218 | + public function extend($id, $callable) { |
|
228 | 219 | if (!isset($this->keys[$id])) { |
229 | 220 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
230 | 221 | } |
@@ -256,8 +247,7 @@ discard block |
||
256 | 247 | * |
257 | 248 | * @return array An array of value names |
258 | 249 | */ |
259 | - public function keys() |
|
260 | - { |
|
250 | + public function keys() { |
|
261 | 251 | return array_keys($this->values); |
262 | 252 | } |
263 | 253 | |
@@ -269,8 +259,7 @@ discard block |
||
269 | 259 | * |
270 | 260 | * @return static |
271 | 261 | */ |
272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
273 | - { |
|
262 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
274 | 263 | $provider->register($this); |
275 | 264 | |
276 | 265 | foreach ($values as $key => $value) { |
@@ -49,8 +49,7 @@ |
||
49 | 49 | SN::db_transaction_commit(); |
50 | 50 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
51 | 51 | } |
52 | - } |
|
53 | - catch (exception $e) |
|
52 | + } catch (exception $e) |
|
54 | 53 | { |
55 | 54 | SN::db_transaction_rollback(); |
56 | 55 | $template->assign_block_vars('result', array( |
@@ -79,8 +79,7 @@ |
||
79 | 79 | |
80 | 80 | SN::db_transaction_commit(); |
81 | 81 | throw new Exception($info_action, ERR_NONE); |
82 | - } |
|
83 | - catch (Exception $e) |
|
82 | + } catch (Exception $e) |
|
84 | 83 | { |
85 | 84 | SN::db_transaction_rollback(); |
86 | 85 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function sn_user_birthday_celebrate() |
|
4 | -{ |
|
3 | +function sn_user_birthday_celebrate() { |
|
5 | 4 | global $config, $lang; |
6 | 5 | |
7 | 6 | SN::db_transaction_start(); |
@@ -74,14 +74,12 @@ discard block |
||
74 | 74 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
75 | 75 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
76 | 76 | } |
77 | -} |
|
78 | -elseif(sys_get_param_str('isSaveText')) |
|
77 | +} elseif(sys_get_param_str('isSaveText')) |
|
79 | 78 | { |
80 | 79 | $text = sys_get_param_str_both('text'); |
81 | 80 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
82 | 81 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
83 | -} |
|
84 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
82 | +} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
85 | 83 | { |
86 | 84 | if(!$isAllyOwner) |
87 | 85 | { |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | SN::db_transaction_commit(); |
99 | 97 | sys_redirect('alliance.php'); |
100 | 98 | } |
101 | -} |
|
102 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
99 | +} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
103 | 100 | { |
104 | 101 | if(!$isAllyOwner) |
105 | 102 | { |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
57 | 57 | SN::db_transaction_commit(); |
58 | 58 | throw new exception('buddy_err_accept_none', ERR_NONE); |
59 | - } |
|
60 | - else |
|
59 | + } else |
|
61 | 60 | { |
62 | 61 | throw new exception('buddy_err_accept_internal', ERR_ERROR); |
63 | 62 | } |
@@ -69,9 +68,11 @@ discard block |
||
69 | 68 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
70 | 69 | } |
71 | 70 | |
72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
71 | + if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
72 | + // Existing friendship |
|
73 | 73 | { |
74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
75 | + } |
|
75 | 76 | |
76 | 77 | msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'], |
77 | 78 | sprintf($lang['buddy_msg_unfriend_text'], $user['username'])); |
@@ -79,17 +80,19 @@ discard block |
||
79 | 80 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
80 | 81 | SN::db_transaction_commit(); |
81 | 82 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
82 | - } |
|
83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
83 | + } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
84 | + // Player's outcoming request - either denied or waiting |
|
84 | 85 | { |
85 | 86 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
87 | + } |
|
86 | 88 | SN::db_transaction_commit(); |
87 | 89 | throw new exception('buddy_err_delete_own', ERR_NONE); |
88 | - } |
|
89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
90 | + } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) { |
|
91 | + // Deny incoming request |
|
90 | 92 | { |
91 | 93 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
92 | 94 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
95 | + } |
|
93 | 96 | |
94 | 97 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_DENIED . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
95 | 98 | SN::db_transaction_commit(); |
@@ -104,8 +107,7 @@ discard block |
||
104 | 107 | if($new_friend_id = sys_get_param_id('request_user_id')) |
105 | 108 | { |
106 | 109 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
107 | - } |
|
108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
110 | + } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
109 | 111 | { |
110 | 112 | $new_friend_row = db_user_by_username($new_friend_name); |
111 | 113 | $new_friend_name = SN::$db->db_escape($new_friend_name); |
@@ -138,8 +140,7 @@ discard block |
||
138 | 140 | SN::db_transaction_commit(); |
139 | 141 | throw new exception('buddy_err_adding_none', ERR_NONE); |
140 | 142 | } |
141 | -} |
|
142 | -catch(exception $e) |
|
143 | +} catch(exception $e) |
|
143 | 144 | { |
144 | 145 | $result[] = array( |
145 | 146 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |