Passed
Push — master ( 1d6c2d...fa2ac1 )
by Anthony
09:05
created
modules/bataille/app/controller/Unite.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 					$temps_recrutement = DateHeure::Secondeenheure($obj->temps_recrutement);
51 51
 				}
52 52
 
53
-				$coef = $this->coef_unite*$niveau;
54
-				$coef_ameliorer = $this->coef_unite*($niveau+1);
53
+				$coef = $this->coef_unite * $niveau;
54
+				$coef_ameliorer = $this->coef_unite * ($niveau + 1);
55 55
 
56 56
 				if ($niveau == 1) $coef = 1;
57 57
 
58 58
 				return [
59 59
 					"caracteristique" => [
60
-						"attaque" => round($base_carac["attaque"]*$coef),
61
-						"defense" => round($base_carac["defense"]*$coef),
62
-						"resistance" => round($base_carac["resistance"]*$coef),
60
+						"attaque" => round($base_carac["attaque"] * $coef),
61
+						"defense" => round($base_carac["defense"] * $coef),
62
+						"resistance" => round($base_carac["resistance"] * $coef),
63 63
 						"vitesse" => $base_carac["vitesse"]
64 64
 					],
65 65
 					"cout_recruter" => [
66
-						"eau" => $ressource["eau"]*$coef,
67
-						"electricite" => $ressource["electricite"]*$coef,
68
-						"fer" => $ressource["fer"]*$coef,
69
-						"fuel" => $ressource["fuel"]*$coef,
66
+						"eau" => $ressource["eau"] * $coef,
67
+						"electricite" => $ressource["electricite"] * $coef,
68
+						"fer" => $ressource["fer"] * $coef,
69
+						"fuel" => $ressource["fuel"] * $coef,
70 70
 					],
71 71
 					"cout_ameliorer" => [
72
-						"eau" => $ressource["eau"]*$coef_ameliorer,
73
-						"electricite" => $ressource["electricite"]*$coef_ameliorer,
74
-						"fer" => $ressource["fer"]*$coef_ameliorer,
75
-						"fuel" => $ressource["fuel"]*$coef_ameliorer,
72
+						"eau" => $ressource["eau"] * $coef_ameliorer,
73
+						"electricite" => $ressource["electricite"] * $coef_ameliorer,
74
+						"fer" => $ressource["fer"] * $coef_ameliorer,
75
+						"fuel" => $ressource["fuel"] * $coef_ameliorer,
76 76
 					],
77 77
 					"temps_recrutement" => $temps_recrutement
78 78
 				];
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			$unites = Bataille::getCentreRecherche()->getAllRechercheType($type);
93 93
 
94 94
 			//recupérer les caractéristiques de l'unité en question
95
-			for ($i=0 ; $i<count($unites) ; $i++) {
95
+			for ($i = 0; $i < count($unites); $i++) {
96 96
 				$unites[$i] += $this->getCaracteristiqueUnite($unites[$i]["recherche"], $unites[$i]["niveau"], $type);
97 97
 				$unites[$i] += ["type" => $type];
98 98
 			}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 				$today = Bataille::getToday();
114 114
 
115 115
 				foreach ($query as $obj) {
116
-					if ($obj->date_fin-$today <= 0) {
116
+					if ($obj->date_fin - $today <= 0) {
117 117
 
118 118
 					}
119 119
 					else {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 					"nom" => $nom,
130 130
 					"type" => $type,
131 131
 					"nombre" => $nombre,
132
-					"date_fin_recrutement" => $date_fin-$today,
132
+					"date_fin_recrutement" => $date_fin - $today,
133 133
 					"id_recrutement" => $id_recrutement
134 134
 				];
135 135
 
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 
167 167
 			//on test si on a assez de ressource pour recruter les unites
168 168
 			//on test si assez de ressources dans la base
169
-			$retirer_eau = $pour_recruter["eau"]*$nombre;
170
-			$retirer_electricite = $pour_recruter["electricite"]*$nombre;
171
-			$retirer_fer = $pour_recruter["fer"]*$nombre;
172
-			$retirer_fuel = $pour_recruter["fuel"]*$nombre;
169
+			$retirer_eau = $pour_recruter["eau"] * $nombre;
170
+			$retirer_electricite = $pour_recruter["electricite"] * $nombre;
171
+			$retirer_fer = $pour_recruter["fer"] * $nombre;
172
+			$retirer_fuel = $pour_recruter["fuel"] * $nombre;
173 173
 			$eau = Bataille::getTestAssezRessourceBase("eau", $retirer_eau);
174 174
 			$electricite = Bataille::getTestAssezRessourceBase("electricite", $retirer_electricite);
175 175
 			$fer = Bataille::getTestAssezRessourceBase("fer", $retirer_fer);
176 176
 			$fuel = Bataille::getTestAssezRessourceBase("fuel", $retirer_fuel);
177 177
 
178 178
 
179
-			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
179
+			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") {
180 180
 				FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités");
181 181
 				return false;
182 182
 			}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				//on retire les ressources
185 185
 				Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-");
186 186
 
187
-				$date_fin = Bataille::getToday()+($temps_recrutement*$nombre);
187
+				$date_fin = Bataille::getToday() + ($temps_recrutement * $nombre);
188 188
 
189 189
 				$dbc->insert("nom", $nom)
190 190
 					->insert("type", $type)
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 			$query = $dbc1->select("coef_niveau_unite")->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_unite = $obj->coef_niveau_unite;
22
+				foreach ($query as $obj) {
23
+					$this->coef_unite = $obj->coef_niveau_unite;
24
+				}
23 25
 			}
24 26
 		}
25 27
 		//-------------------------- END BUILDER ----------------------------------------------------------------------------//
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 				$coef = $this->coef_unite*$niveau;
54 56
 				$coef_ameliorer = $this->coef_unite*($niveau+1);
55 57
 
56
-				if ($niveau == 1) $coef = 1;
58
+				if ($niveau == 1) {
59
+					$coef = 1;
60
+				}
57 61
 
58 62
 				return [
59 63
 					"caracteristique" => [
@@ -76,8 +80,7 @@  discard block
 block discarded – undo
76 80
 					],
77 81
 					"temps_recrutement" => $temps_recrutement
78 82
 				];
79
-			}
80
-			else {
83
+			} else {
81 84
 				return [];
82 85
 			}
83 86
 		}
@@ -115,8 +118,7 @@  discard block
 block discarded – undo
115 118
 				foreach ($query as $obj) {
116 119
 					if ($obj->date_fin-$today <= 0) {
117 120
 
118
-					}
119
-					else {
121
+					} else {
120 122
 						$nom = $obj->nom;
121 123
 						$type = $obj->type;
122 124
 						$nombre = $obj->nombre;
@@ -179,8 +181,7 @@  discard block
 block discarded – undo
179 181
 			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
180 182
 				FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités");
181 183
 				return false;
182
-			}
183
-			else {
184
+			} else {
184 185
 				//on retire les ressources
185 186
 				Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-");
186 187
 
Please login to merge, or discard this patch.