@@ -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>"); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $debris_for_moon = $debris->debris_total(); |
74 | 74 | |
75 | - if(!$debris_for_moon) { |
|
75 | + if (!$debris_for_moon) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $moon_chance = min($debris_for_moon / UBE_MOON_DEBRIS_PER_PERCENT, UBE_MOON_PERCENT_MAX); // TODO Configure |
81 | 81 | $moon_chance = $moon_chance >= UBE_MOON_PERCENT_MIN ? $moon_chance : 0; |
82 | 82 | $this->create_chance = $moon_chance; |
83 | - if($moon_chance) { |
|
84 | - if($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
83 | + if ($moon_chance) { |
|
84 | + if ($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
85 | 85 | $this->status = UBE_MOON_CREATE_SUCCESS; |
86 | 86 | $this->moon_diameter = round($is_simulator ? $moon_chance * 150 + 1999 : mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999)); |
87 | 87 | |
88 | - if($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
88 | + if ($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
89 | 89 | $debris->_reset(); |
90 | 90 | } else { |
91 | 91 | $moon_debris_left_percent = ($debris_for_moon - UBE_MOON_DEBRIS_MAX_SPENT) / $debris_for_moon; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function moon_destroy_try($reapers) { |
106 | 106 | // TODO: $is_simulator |
107 | - if($reapers <= 0) { |
|
107 | + if ($reapers <= 0) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @version 2016-02-25 23:42:45 41a4.68 |
123 | 123 | */ |
124 | 124 | public function calculate_moon(UBE $ube) { |
125 | - if(UBE_MOON_EXISTS == $this->status) { |
|
126 | - if($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
125 | + if (UBE_MOON_EXISTS == $this->status) { |
|
126 | + if ($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
127 | 127 | $reapers = $ube->fleet_list->ube_calculate_attack_reapers(); |
128 | 128 | $this->moon_destroy_try($reapers); |
129 | 129 | } |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function report_generate_array() { |
139 | 139 | return array( |
140 | - 'ube_report_moon' => (int)$this->status, |
|
141 | - 'ube_report_moon_chance' => (int)$this->create_chance, |
|
142 | - 'ube_report_moon_size' => (float)$this->moon_diameter, |
|
143 | - 'ube_report_moon_reapers' => (int)$this->reapers_status, |
|
144 | - 'ube_report_moon_destroy_chance' => (int)$this->destroy_chance, |
|
145 | - 'ube_report_moon_reapers_die_chance' => (int)$this->reaper_die_chance, |
|
140 | + 'ube_report_moon' => (int) $this->status, |
|
141 | + 'ube_report_moon_chance' => (int) $this->create_chance, |
|
142 | + 'ube_report_moon_size' => (float) $this->moon_diameter, |
|
143 | + 'ube_report_moon_reapers' => (int) $this->reapers_status, |
|
144 | + 'ube_report_moon_destroy_chance' => (int) $this->destroy_chance, |
|
145 | + 'ube_report_moon_reapers_die_chance' => (int) $this->reaper_die_chance, |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param $planet_id |
174 | 174 | */ |
175 | 175 | public function db_apply_result($planet_info, $destination_user_id) { |
176 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
176 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
177 | 177 | $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $this->moon_diameter, '', false); |
178 | 178 | $this->moon_name = $moon_row['name']; |
179 | 179 | unset($moon_row); |
180 | - } elseif($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
180 | + } elseif ($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
181 | 181 | DBStaticPlanet::db_planet_delete_by_id($planet_info[PLANET_ID]); |
182 | 182 | } |
183 | 183 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $classLocale = classLocale::$lang; |
187 | 187 | |
188 | 188 | $text_defender = ''; |
189 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
189 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
190 | 190 | $text_defender .= "{$classLocale['ube_report_moon_created']} {$this->moon_diameter} {$classLocale['sys_kilometers_short']}<br /><br />"; |
191 | - } elseif($this->status == UBE_MOON_CREATE_FAILED) { |
|
191 | + } elseif ($this->status == UBE_MOON_CREATE_FAILED) { |
|
192 | 192 | $text_defender .= "{$classLocale['ube_report_moon_chance']} {$this->create_chance}%<br /><br />"; |
193 | 193 | } |
194 | 194 | |
195 | - if($ube->mission_type_id == MT_DESTROY) { |
|
196 | - if($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
195 | + if ($ube->mission_type_id == MT_DESTROY) { |
|
196 | + if ($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
197 | 197 | $text_defender .= classLocale::$lang['ube_report_moon_reapers_none']; |
198 | 198 | } else { |
199 | 199 | $text_defender .= "{$classLocale['ube_report_moon_reapers_wave']}. {$classLocale['ube_report_moon_reapers_chance']} {$this->destroy_chance}%. "; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @version 2016-02-25 23:42:45 41a4.68 |
223 | 223 | */ |
224 | 224 | public function ubeInitLoadStatis($destination_planet) { |
225 | - if($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
225 | + if ($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
226 | 226 | $this->status = UBE_MOON_EXISTS; |
227 | 227 | $this->moon_diameter = !empty($moon['planet_type']) && $moon['planet_type'] == PT_MOON ? $moon['diameter'] : $destination_planet['diameter']; |
228 | 228 | $this->reapers_status = UBE_MOON_REAPERS_NONE; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param db_mysql|null $db |
87 | 87 | */ |
88 | 88 | public static function setDb($db = null) { |
89 | - if(empty($db) || !($db instanceof db_mysql)) { |
|
89 | + if (empty($db) || !($db instanceof db_mysql)) { |
|
90 | 90 | $db = null; |
91 | 91 | } |
92 | 92 | static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | - if(empty($set)) { |
|
455 | + if (empty($set)) { |
|
456 | 456 | $theResult = true; |
457 | 457 | } else { |
458 | 458 | $theResult = classSupernova::$db->doUpdateRowAdjust( |
@@ -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 | * |