@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | !is_array($offset) ? $offset = array($offset) : false; |
39 | 39 | |
40 | 40 | $current_leaf = $this->__get(reset($offset)); |
41 | - while(($leaf_index = next($offset)) !== false) { |
|
42 | - if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) { |
|
41 | + while (($leaf_index = next($offset)) !== false) { |
|
42 | + if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) { |
|
43 | 43 | unset($current_leaf); |
44 | 44 | break; |
45 | 45 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | !is_array($offset) ? $offset = array($offset) : false; |
66 | 66 | |
67 | - if($this->offsetExists($offset)) { |
|
67 | + if ($this->offsetExists($offset)) { |
|
68 | 68 | $result = $this->__get(reset($offset)); |
69 | - while(($leaf_index = next($offset)) !== false) { |
|
69 | + while (($leaf_index = next($offset)) !== false) { |
|
70 | 70 | $result = $result[$leaf_index]; |
71 | 71 | } |
72 | 72 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function offsetSet($offset, $value = null) { |
93 | 93 | // Если нет никакого индекса - значит нечего записывать |
94 | - if(!isset($offset) || (is_array($offset) && empty($offset))) { |
|
94 | + if (!isset($offset) || (is_array($offset) && empty($offset))) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | 98 | // Если в массиве индекса только один элемент - значит это просто индекс |
99 | - if(is_array($offset) && count($offset) == 1) { |
|
99 | + if (is_array($offset) && count($offset) == 1) { |
|
100 | 100 | // Разворачиваем его в индекс |
101 | 101 | $offset = array(reset($offset) => $value); |
102 | 102 | unset($value); |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | // Адресация многомерного массива через массив индексов в $option |
107 | - if(is_array($offset) && isset($value)) { |
|
107 | + if (is_array($offset) && isset($value)) { |
|
108 | 108 | // TODO - а не переделать ли это всё на __isset() ?? |
109 | 109 | //pdump($offset, '$offset'); |
110 | 110 | //pdump($value, '$value'); |
111 | 111 | // Вытаскиваем корневой элемент |
112 | 112 | $root = $this->__get(reset($offset)); |
113 | 113 | $current_leaf = &$root; |
114 | - while(($leaf_index = next($offset)) !== false) { |
|
114 | + while (($leaf_index = next($offset)) !== false) { |
|
115 | 115 | !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false; |
116 | 116 | $current_leaf = &$current_leaf[$leaf_index]; |
117 | 117 | } |
118 | 118 | //pdump($current_leaf, '$current_leaf'); |
119 | 119 | //pdump($value, '$value'); |
120 | - if($current_leaf != $value) { |
|
120 | + if ($current_leaf != $value) { |
|
121 | 121 | $current_leaf = $value; |
122 | 122 | //pdump(reset($offset), 'reset($offset)'); |
123 | 123 | //pdump($root, '$root'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // Пакетная запись из массива ключ -> значение |
129 | 129 | !is_array($offset) ? $offset = array($offset => $value) : false; |
130 | 130 | |
131 | - foreach($offset as $key => $value) { |
|
131 | + foreach ($offset as $key => $value) { |
|
132 | 132 | $this->__get($key) !== $value ? $this->__set($key, $value) : false; |
133 | 133 | } |
134 | 134 | } |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function offsetUnset($offset) { |
151 | 151 | // Если нет никакого индекса - значит нечего записывать |
152 | - if(!isset($offset) || (is_array($offset) && empty($offset))) { |
|
152 | + if (!isset($offset) || (is_array($offset) && empty($offset))) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | 156 | !is_array($offset) ? $offset = array($offset) : false; |
157 | 157 | |
158 | - if($this->offsetExists($offset)) { |
|
158 | + if ($this->offsetExists($offset)) { |
|
159 | 159 | //pdump($offset); |
160 | 160 | // Перематываем массив в конец |
161 | 161 | $key_to_delete = end($offset); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | //pdump($key_to_delete, '$key_to_delete'); |
164 | 164 | $parent_offset = $offset; |
165 | 165 | array_pop($parent_offset); |
166 | - if(!count($parent_offset)) { |
|
166 | + if (!count($parent_offset)) { |
|
167 | 167 | // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент |
168 | 168 | $this->__unset($key_to_delete); |
169 | 169 | } else { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | // OK 4.9 |
37 | 37 | public function __construct($filename = __FILE__) { |
38 | - if($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
38 | + if ($this->provider_id == ACCOUNT_PROVIDER_NONE) { |
|
39 | 39 | die('У всех провайдеров должен быть $provider_id!'); |
40 | 40 | } |
41 | 41 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // OK 4.6 |
134 | 134 | public function player_name_suggest() { |
135 | 135 | $name = ''; |
136 | - if(is_object($this->account) && !empty($this->account->account_email)) { |
|
136 | + if (is_object($this->account) && !empty($this->account->account_email)) { |
|
137 | 137 | list($name) = explode('@', $this->account->account_email); |
138 | 138 | } |
139 | 139 |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | * @return int|mixed |
229 | 229 | */ |
230 | 230 | public function calcColonyMaxCount($astrotech = -1) { |
231 | - if($astrotech == -1) { |
|
232 | - if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
231 | + if ($astrotech == -1) { |
|
232 | + if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
233 | 233 | |
234 | 234 | $expeditions = get_player_max_expeditons($this->_dbRow); |
235 | 235 | $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | |
304 | 304 | public function expeditionsMax() { |
305 | - if($this->expeditionsMax === null) { |
|
305 | + if ($this->expeditionsMax === null) { |
|
306 | 306 | $this->expeditionsMax = get_player_max_expeditons($this->_dbRow); |
307 | 307 | } |
308 | 308 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | public function expeditionsFlying() { |
313 | - if($this->expeditionsFlying === null) { |
|
313 | + if ($this->expeditionsFlying === null) { |
|
314 | 314 | $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE); |
315 | 315 | } |
316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | |
321 | 321 | public function fleetsMax() { |
322 | - if($this->fleetMax === null) { |
|
322 | + if ($this->fleetMax === null) { |
|
323 | 323 | $this->fleetMax = GetMaxFleets($this->_dbRow); |
324 | 324 | } |
325 | 325 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | public function fleetsFlying() { |
330 | - if($this->fleetFlying === null) { |
|
330 | + if ($this->fleetFlying === null) { |
|
331 | 331 | $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId); |
332 | 332 | } |
333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | |
338 | 338 | public function coloniesMax() { |
339 | - if($this->coloniesMax === null) { |
|
339 | + if ($this->coloniesMax === null) { |
|
340 | 340 | $this->coloniesMax = get_player_max_colonies($this->_dbRow); |
341 | 341 | } |
342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | public function coloniesCurrent() { |
347 | - if($this->coloniesCurrent === null) { |
|
347 | + if ($this->coloniesCurrent === null) { |
|
348 | 348 | $this->coloniesCurrent = get_player_current_colonies($this->_dbRow); |
349 | 349 | } |
350 | 350 |
@@ -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 | } |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $account_translation = array(); |
89 | 89 | |
90 | 90 | $query = static::$db->doquery( |
91 | - "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " . |
|
92 | - ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') . |
|
91 | + "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} ". |
|
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 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @return bool |
39 | 39 | */ |
40 | 40 | public function isEmpty() { |
41 | - throw new \Exception(get_class() . '::isEmpty() not implemented - inherited from ContainerPlus'); |
|
41 | + throw new \Exception(get_class().'::isEmpty() not implemented - inherited from ContainerPlus'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return mixed |
48 | 48 | */ |
49 | 49 | public function clear() { |
50 | - throw new \Exception(get_class() . '::clear() not implemented - inherited from ContainerPlus'); |
|
50 | + throw new \Exception(get_class().'::clear() not implemented - inherited from ContainerPlus'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function castAs($type, $value) { |
14 | 14 | // TODO: Here should be some conversions to property type |
15 | - switch($type) { |
|
15 | + switch ($type) { |
|
16 | 16 | case TYPE_INTEGER: |
17 | 17 | $value = intval($value); |
18 | 18 | break; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | break; |
31 | 31 | |
32 | 32 | case TYPE_ARRAY: |
33 | - $value = (array)$value; |
|
33 | + $value = (array) $value; |
|
34 | 34 | break; |
35 | 35 | |
36 | 36 | case TYPE_STRING: |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | case TYPE_EMPTY: |
39 | 39 | // No-type defaults to string |
40 | 40 | default: |
41 | - $value = (string)$value; |
|
41 | + $value = (string) $value; |
|
42 | 42 | break; |
43 | 43 | } |
44 | 44 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @throws ExceptionFleetInvalid |
35 | 35 | */ |
36 | 36 | public static function build($missionType, $fleet) { |
37 | - if (!empty(self::$missions[$missionType]) && class_exists($className = __NAMESPACE__ . '\\' . self::$missions[$missionType])) { |
|
37 | + if (!empty(self::$missions[$missionType]) && class_exists($className = __NAMESPACE__.'\\'.self::$missions[$missionType])) { |
|
38 | 38 | $result = new $className($fleet); |
39 | 39 | } else { |
40 | 40 | throw new ExceptionFleetInvalid("Mission type {$missionType} unknown", FLIGHT_MISSION_UNKNOWN); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * @package Buddy |
22 | 22 | */ |
23 | -class BuddyModel extends \Entity\KeyedModel{ |
|
23 | +class BuddyModel extends \Entity\KeyedModel { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Name of table for this entity |
@@ -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. |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | // $this->playerArray = $user; |
41 | 41 | |
42 | - $this->playerId = function (BuddyParams $cBuddy) { |
|
42 | + $this->playerId = function(BuddyParams $cBuddy) { |
|
43 | 43 | return $cBuddy->playerArray['id']; |
44 | 44 | }; |
45 | - $this->playerName = function (BuddyParams $cBuddy) { |
|
45 | + $this->playerName = function(BuddyParams $cBuddy) { |
|
46 | 46 | return $cBuddy->playerArray['username']; |
47 | 47 | }; |
48 | - $this->playerNameAndCoordinates = function (BuddyParams $cBuddy) { |
|
49 | - return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray); |
|
48 | + $this->playerNameAndCoordinates = function(BuddyParams $cBuddy) { |
|
49 | + return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray); |
|
50 | 50 | }; |
51 | 51 | } |
52 | 52 |