Passed
Push — master ( ffd9ca...7c57b8 )
by Anthony
02:23
created
modules/bataille/app/controller/CentreRecherche.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 		/**
92 92
 		 * @param $cout
93
-		 * @param $niveau_recherche
93
+		 * @param integer $niveau_recherche
94 94
 		 * @return array
95 95
 		 * fonction qui renvoi le cout d'une recherche
96 96
 		 */
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		/**
107 107
 		 * @param $temps
108 108
 		 * @param int $niveau
109
-		 * @return floatfonction qui renvoi le temps qu'il faut pour effectuer une recherche
109
+		 * @return double qui renvoi le temps qu'il faut pour effectuer une recherche
110 110
 		 */
111 111
 		private function getTempsRecherche($temps, $niveau = 0) {
112 112
 			$pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100);
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		 * @return floatfonction qui renvoi le temps qu'il faut pour effectuer une recherche
110 110
 		 */
111 111
 		private function getTempsRecherche($temps, $niveau = 0) {
112
-			$pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100);
112
+			$pourcent = ($temps * Bataille::getBatiment()->getNiveauBatiment("centre_recherche") / 100);
113 113
 
114 114
 			if ($niveau == 0) {
115
-				return round($temps-$pourcent);;
115
+				return round($temps - $pourcent); ;
116 116
 			}
117 117
 
118
-			return round(($temps * ($this->coef_centre * $niveau))-$pourcent);
118
+			return round(($temps * ($this->coef_centre * $niveau)) - $pourcent);
119 119
 		}
120 120
 
121 121
 		/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 					$this->recherche = $obj->recherche;
161 161
 					$this->type = $obj->type;
162 162
 
163
-					if ($obj->date_fin-$today <= 0) {
163
+					if ($obj->date_fin - $today <= 0) {
164 164
 						$this->setTerminerRecherche($obj->ID_recherche);
165 165
 					}
166 166
 					else {
167 167
 						$recherche = [
168 168
 							"recherche" => $obj->recherche,
169 169
 							"type" => $obj->type,
170
-							"date_fin_recherche" => $obj->date_fin-$today,
170
+							"date_fin_recherche" => $obj->date_fin - $today,
171 171
 							"id_recherche" => $obj->ID_recherche
172 172
 						];
173 173
 					}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$fuel = Bataille::getTestAssezRessourceBase("fuel", $cout["fuel"]);
227 227
 
228 228
 
229
-			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
229
+			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") {
230 230
 				FlashMessage::setFlash("Pas assez de ressources pour effectuer cette recherche");
231 231
 				return false;
232 232
 			}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				//on retire les ressources
235 235
 				Bataille::getRessource()->setUpdateRessource($cout["eau"], $cout["electricite"], $cout["fer"], $cout["fuel"], 0, "-");
236 236
 
237
-				$date_fin = Bataille::getToday()+$temps_recherche;
237
+				$date_fin = Bataille::getToday() + $temps_recherche;
238 238
 
239 239
 				$dbc->insert("recherche", $recherche)
240 240
 					->insert("type", $type)
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 					->set();
261 261
 			}
262 262
 			else {
263
-				$dbc->update("niveau", $niveau_recherche+1)
263
+				$dbc->update("niveau", $niveau_recherche + 1)
264 264
 					->from("_bataille_centre_recherche")
265 265
 					->where("recherche", "=", $this->recherche, "AND")
266 266
 					->where("type", "=", $this->type, "AND")
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 			$query = $dbc1->select("coef_centre_recherche")->from("configuration")->where("ID_configuration", "=", 1)->get();
20 20
 
21 21
 			if ((is_array($query)) && (count($query) == 1)) {
22
-				foreach ($query as $obj) $this->coef_centre = $obj->coef_centre_recherche;
22
+				foreach ($query as $obj) {
23
+					$this->coef_centre = $obj->coef_centre_recherche;
24
+				}
23 25
 			}
24 26
 
25 27
 			$query = $dbc1->select()->from("recherche")
@@ -38,8 +40,7 @@  discard block
 block discarded – undo
38 40
 					if ($niveau > 0) {
39 41
 						$cout = $this->getCoutRecherche($cout, $niveau);
40 42
 						$temps_recherche = $this->getTempsRecherche($temps_recherche, $niveau);
41
-					}
42
-					else {
43
+					} else {
43 44
 						$niveau_recherche = 1;
44 45
 					}
45 46
 
@@ -162,8 +163,7 @@  discard block
 block discarded – undo
162 163
 
163 164
 					if ($obj->date_fin-$today <= 0) {
164 165
 						$this->setTerminerRecherche($obj->ID_recherche);
165
-					}
166
-					else {
166
+					} else {
167 167
 						$recherche = [
168 168
 							"recherche" => $obj->recherche,
169 169
 							"type" => $obj->type,
@@ -229,8 +229,7 @@  discard block
 block discarded – undo
229 229
 			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
230 230
 				FlashMessage::setFlash("Pas assez de ressources pour effectuer cette recherche");
231 231
 				return false;
232
-			}
233
-			else {
232
+			} else {
234 233
 				//on retire les ressources
235 234
 				Bataille::getRessource()->setUpdateRessource($cout["eau"], $cout["electricite"], $cout["fer"], $cout["fuel"], 0, "-");
236 235
 
@@ -258,8 +257,7 @@  discard block
 block discarded – undo
258 257
 					->insert("ID_base", Bataille::getIdBase())
259 258
 					->into("_bataille_centre_recherche")
260 259
 					->set();
261
-			}
262
-			else {
260
+			} else {
263 261
 				$dbc->update("niveau", $niveau_recherche+1)
264 262
 					->from("_bataille_centre_recherche")
265 263
 					->where("recherche", "=", $this->recherche, "AND")
Please login to merge, or discard this patch.