@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | // TODO - rewrite |
232 | 232 | public function getParamsFromStaticClass($className) { |
233 | 233 | if (is_string($className) && $className && class_exists($className)) { |
234 | - if(method_exists($className, 'getDb')) { |
|
234 | + if (method_exists($className, 'getDb')) { |
|
235 | 235 | $this->setDb($className::getDb()); |
236 | 236 | } |
237 | 237 | $this->from($className::$_table); |
@@ -398,14 +398,14 @@ discard block |
||
398 | 398 | */ |
399 | 399 | protected function processField($fieldName) { |
400 | 400 | if (is_bool($fieldName)) { |
401 | - $result = (string)intval($fieldName); |
|
401 | + $result = (string) intval($fieldName); |
|
402 | 402 | } elseif (is_numeric($fieldName)) { |
403 | 403 | $result = $fieldName; |
404 | 404 | } elseif (is_null($fieldName)) { |
405 | 405 | $result = 'NULL'; |
406 | 406 | } else { |
407 | 407 | // Field has other type - string or should be convertible to string |
408 | - $result = (string)$fieldName; |
|
408 | + $result = (string) $fieldName; |
|
409 | 409 | if (!$fieldName instanceof DbSqlLiteral) { |
410 | 410 | $result = $this->quoteField($fieldName); |
411 | 411 | } |
@@ -248,7 +248,7 @@ |
||
248 | 248 | */ |
249 | 249 | public function unitsCostInMetal($shipCostInMetalPerPiece) { |
250 | 250 | $shipsCostInMetal = array(); |
251 | - foreach($this->mapUnitIdToDb as $ship_id => $ship) { |
|
251 | + foreach ($this->mapUnitIdToDb as $ship_id => $ship) { |
|
252 | 252 | $shipsCostInMetal[$ship_id] = $ship->count * $shipCostInMetalPerPiece[$ship_id]; |
253 | 253 | } |
254 | 254 |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return string |
278 | 278 | */ |
279 | 279 | protected function adjustPropertyString($name, $diff) { |
280 | - return (string)$this->$name . (string)$diff; |
|
280 | + return (string) $this->$name . (string) $diff; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | * @return array |
288 | 288 | */ |
289 | 289 | protected function adjustPropertyArray($name, $diff) { |
290 | - $copy = (array)$this->$name; |
|
291 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
290 | + $copy = (array) $this->$name; |
|
291 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
292 | 292 | |
293 | 293 | return $copy; |
294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return int |
301 | 301 | */ |
302 | 302 | protected function deltaInteger($name, $diff) { |
303 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
303 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return float |
311 | 311 | */ |
312 | 312 | protected function deltaDouble($name, $diff) { |
313 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
313 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @return string |
321 | 321 | */ |
322 | 322 | protected function deltaString($name, $diff) { |
323 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
323 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string) $diff; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return array |
331 | 331 | */ |
332 | 332 | protected function deltaArray($name, $diff) { |
333 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
333 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
334 | 334 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
335 | 335 | |
336 | 336 | return $copy; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | protected function quoteFieldSimpleByRef(&$string) { |
61 | 61 | $string = $this->escapeString($string); |
62 | - if ((string)$string && '*' != $string) { |
|
62 | + if ((string) $string && '*' != $string) { |
|
63 | 63 | $string = '`' . $string . '`'; |
64 | 64 | } |
65 | 65 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | protected static $is_init = false; |
20 | 20 | |
21 | 21 | protected static function init() { |
22 | - if(!empty(static::$db)) { |
|
22 | + if (!empty(static::$db)) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | static::$db = classSupernova::$db; |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $provider_id_safe = intval($provider_id_unsafe); |
67 | 67 | !is_array($account_list) ? $account_list = array($account_list) : false; |
68 | 68 | |
69 | - foreach($account_list as $provider_account_id_unsafe) { |
|
69 | + foreach ($account_list as $provider_account_id_unsafe) { |
|
70 | 70 | $provider_account_id_safe = intval($provider_account_id_unsafe); |
71 | 71 | |
72 | 72 | // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером |
73 | 73 | $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE"); |
74 | - while($row = static::$db->db_fetch($query)) { |
|
74 | + while ($row = static::$db->db_fetch($query)) { |
|
75 | 75 | $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true; |
76 | 76 | } |
77 | 77 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " . |
92 | 92 | ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') . |
93 | 93 | "ORDER BY `timestamp` FOR UPDATE"); |
94 | - while($row = static::$db->db_fetch($query)) { |
|
94 | + while ($row = static::$db->db_fetch($query)) { |
|
95 | 95 | $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row; |
96 | 96 | } |
97 | 97 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @property string $playerName |
22 | 22 | * @property string $playerNameAndCoordinates |
23 | 23 | */ |
24 | -class BuddyParams extends ContainerPlus { |
|
24 | +class BuddyParams extends ContainerPlus { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * BuddyParams constructor. |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | $this->new_friend_name_unsafe = sys_get_param_str_unsafe('request_user_name'); |
38 | 38 | $this->request_text_unsafe = sys_get_param_str_unsafe('request_text'); |
39 | 39 | |
40 | - $this->playerId = function (BuddyParams $cBuddy) { |
|
40 | + $this->playerId = function(BuddyParams $cBuddy) { |
|
41 | 41 | return $cBuddy->playerArray['id']; |
42 | 42 | }; |
43 | - $this->playerName = function (BuddyParams $cBuddy) { |
|
43 | + $this->playerName = function(BuddyParams $cBuddy) { |
|
44 | 44 | return $cBuddy->playerArray['username']; |
45 | 45 | }; |
46 | - $this->playerNameAndCoordinates = function (BuddyParams $cBuddy) { |
|
46 | + $this->playerNameAndCoordinates = function(BuddyParams $cBuddy) { |
|
47 | 47 | return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray); |
48 | 48 | }; |
49 | 49 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @property string $playerName |
22 | 22 | * @property string $playerNameAndCoordinates |
23 | 23 | */ |
24 | -class BuddyParams extends ContainerPlus { |
|
24 | +class BuddyParams extends ContainerPlus { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * BuddyParams constructor. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | protected function setInsertCommand($replace) { |
143 | - switch($replace) { |
|
143 | + switch ($replace) { |
|
144 | 144 | case DB_INSERT_IGNORE: |
145 | 145 | $result = static::INSERT_IGNORE; |
146 | 146 | break; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->build = array(); |
161 | 161 | $this->buildCommand($this->setInsertCommand($replace)); |
162 | 162 | |
163 | - if(!$forceSingleInsert && is_array($this->fields) && !empty($this->fields)) { |
|
163 | + if (!$forceSingleInsert && is_array($this->fields) && !empty($this->fields)) { |
|
164 | 164 | // If there are fields - it's batch insert... unless it forced single insert |
165 | 165 | $this->build[] = " ("; |
166 | 166 | $this->buildFieldNames(); // used $this->fields |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return string |
311 | 311 | */ |
312 | 312 | protected function stringValue($value) { |
313 | - return "'" . $this->escape((string)$value) . "'"; |
|
313 | + return "'" . $this->escape((string) $value) . "'"; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return string |
322 | 322 | */ |
323 | 323 | public function quote($fieldName) { |
324 | - return "`" . $this->escape((string)$fieldName) . "`"; |
|
324 | + return "`" . $this->escape((string) $fieldName) . "`"; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | public function makeAdjustString($fieldValue, $fieldName) { |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * @return string |
346 | 346 | */ |
347 | 347 | protected function quoteTable($tableName) { |
348 | - return "`{{" . $this->escape((string)$tableName) . "}}`"; |
|
348 | + return "`{{" . $this->escape((string) $tableName) . "}}`"; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | public function castAsDbValue($value) { |
352 | - switch(gettype($value)) { |
|
352 | + switch (gettype($value)) { |
|
353 | 353 | case TYPE_INTEGER: |
354 | 354 | case TYPE_DOUBLE: |
355 | 355 | // do nothing |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | |
382 | 382 | protected function buildCommand($command) { |
383 | - switch($this->command = $command) { |
|
383 | + switch ($this->command = $command) { |
|
384 | 384 | case static::UPDATE: |
385 | 385 | $this->build[] = $this->command . " " . $this->quoteTable($this->table); |
386 | 386 | break; |
@@ -15,11 +15,11 @@ |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | public static function quoteComment($comment) { |
18 | - if($comment == '') { |
|
18 | + if ($comment == '') { |
|
19 | 19 | return ''; |
20 | 20 | } |
21 | 21 | |
22 | - $comment = str_replace(array('/*', '*/'), '__',$comment); |
|
22 | + $comment = str_replace(array('/*', '*/'), '__', $comment); |
|
23 | 23 | |
24 | 24 | return "\r\n/*" . $comment . "*/"; |
25 | 25 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @version 41a6.0 |
12 | 12 | */ |
13 | 13 | public static function unit_dump_header() { |
14 | - if(!defined('DEBUG_UBE')) { |
|
14 | + if (!defined('DEBUG_UBE')) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @version 41a6.0 |
49 | 49 | */ |
50 | 50 | public static function unit_dump(UBEUnit $unit, $desc = '', UBEUnit $before = null) { |
51 | - if(!defined('DEBUG_UBE')) { |
|
51 | + if (!defined('DEBUG_UBE')) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @version 41a6.0 |
87 | 87 | */ |
88 | 88 | public static function unit_dump_footer() { |
89 | - if(!defined('DEBUG_UBE')) { |
|
89 | + if (!defined('DEBUG_UBE')) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return UBEUnit |
102 | 102 | */ |
103 | 103 | public static function unit_dump_defender(UBEUnit $attacking_unit_pool, UBEUnit $defending_unit_pool, $defending_fleet_id) { |
104 | - if(!defined('DEBUG_UBE')) { |
|
104 | + if (!defined('DEBUG_UBE')) { |
|
105 | 105 | return null; |
106 | 106 | } |
107 | 107 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @version 41a6.0 |
128 | 128 | */ |
129 | 129 | public static function unit_dump_delta(UBEUnit $unit, $field, UBEUnit $before = null) { |
130 | - if(!defined('DEBUG_UBE')) { |
|
130 | + if (!defined('DEBUG_UBE')) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | print(pretty_number($unit->$field)); |
137 | 137 | print("</td>"); |
138 | 138 | print("<td>"); |
139 | - if(!empty($before)) { |
|
139 | + if (!empty($before)) { |
|
140 | 140 | print('' . pretty_number($unit->$field - $before->$field) . ''); |
141 | 141 | } |
142 | 142 | print("</td>"); |