Passed
Push — master ( 5c0550...ffd9ca )
by Anthony
02:19
created
modules/bataille/app/controller/CentreRecherche.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 
93 93
 		private function getTempsRecherche($temps, $niveau = 0) {
94
-			$pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100);
94
+			$pourcent = ($temps * Bataille::getBatiment()->getNiveauBatiment("centre_recherche") / 100);
95 95
 
96 96
 			if ($niveau == 0) {
97
-				return round($temps-$pourcent);;
97
+				return round($temps - $pourcent); ;
98 98
 			}
99 99
 
100
-			return round(($temps * ($this->coef_centre * $niveau))-$pourcent);
100
+			return round(($temps * ($this->coef_centre * $niveau)) - $pourcent);
101 101
 		}
102 102
 		//-------------------------- END BUILDER ----------------------------------------------------------------------------//
103 103
 		
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				$temps_recherche = $this->getTempsRecherche($temps_recherche, $niveau_recherche);
171 171
 			}
172 172
 
173
-			$date_fin = Bataille::getToday()+$temps_recherche;
173
+			$date_fin = Bataille::getToday() + $temps_recherche;
174 174
 
175 175
 			$dbc->insert("recherche", $recherche)
176 176
 				->insert("type", $type)
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 			$query = $dbc1->select("coef_centre_recherche")->from("configuration")->where("ID_configuration", "=", 1)->get();
17 17
 
18 18
 			if ((is_array($query)) && (count($query) == 1)) {
19
-				foreach ($query as $obj) $this->coef_centre = $obj->coef_centre_recherche;
19
+				foreach ($query as $obj) {
20
+					$this->coef_centre = $obj->coef_centre_recherche;
21
+				}
20 22
 			}
21 23
 
22 24
 			$query = $dbc1->select()->from("recherche")
@@ -35,8 +37,7 @@  discard block
 block discarded – undo
35 37
 					if ($niveau > 0) {
36 38
 						$cout = $this->getCoutRecherche($cout, $niveau);
37 39
 						$temps_recherche = $this->getTempsRecherche($temps_recherche, $niveau);
38
-					}
39
-					else {
40
+					} else {
40 41
 						$niveau_recherche = 1;
41 42
 					}
42 43
 
@@ -146,7 +147,9 @@  discard block
 block discarded – undo
146 147
 				->get();
147 148
 
148 149
 			if ((is_array($query)) && (count($query) == 1)) {
149
-				foreach ($query as $obj) $niveau_recherche = $obj->niveau;
150
+				foreach ($query as $obj) {
151
+					$niveau_recherche = $obj->niveau;
152
+				}
150 153
 			}
151 154
 
152 155
 			//récupération du cout initial plus temps de recherche initial pour calculer les bon en fonction
Please login to merge, or discard this patch.
modules/bataille/app/controller/Unite.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,32 +47,32 @@  discard block
 block discarded – undo
47 47
 				foreach ($query as $obj) {
48 48
 					$base_carac = unserialize($obj->caracteristique);
49 49
 					$ressource = unserialize($obj->pour_recruter);
50
-					$temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100)));
50
+					$temps_recrutement = DateHeure::Secondeenheure(round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100)));
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
 				];
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			$unites = Bataille::getCentreRecherche()->getAllRechercheType($type);
107 107
 
108 108
 			//recupérer les caractéristiques de l'unité en question
109
-			for ($i=0 ; $i<count($unites) ; $i++) {
109
+			for ($i = 0; $i < count($unites); $i++) {
110 110
 				$unites[$i] += $this->getCaracteristiqueUnite($unites[$i]["recherche"], $unites[$i]["niveau"], $type);
111 111
 				$unites[$i] += ["type" => $type];
112 112
 			}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				$today = Bataille::getToday();
127 127
 
128 128
 				foreach ($query as $obj) {
129
-					if ($obj->date_fin-$today <= 0) {
129
+					if ($obj->date_fin - $today <= 0) {
130 130
 						$this->setTerminerRecrutement($obj->ID_recrutement);
131 131
 					}
132 132
 					else {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 							"nom" => $obj->nom,
135 135
 							"type" => $obj->type,
136 136
 							"nombre" => $obj->nombre,
137
-							"date_fin_recrutement" => $obj->date_fin-$today,
137
+							"date_fin_recrutement" => $obj->date_fin - $today,
138 138
 							"id_recrutement" => $obj->ID_recrutement
139 139
 						];
140 140
 					}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			$count_type = count($types);
157 157
 			$unites = [];
158 158
 
159
-			for ($i=0 ; $i<$count_type ; $i++) {
159
+			for ($i = 0; $i < $count_type; $i++) {
160 160
 				$type_unite = $this->getAllUniteType($types[$i], $id_base);
161 161
 
162 162
 				$unites = array_merge($unites, $type_unite);
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
 			if ((is_array($query)) && (count($query) == 1)) {
223 223
 				foreach ($query as $obj) {
224 224
 					$pour_recruter = unserialize($obj->pour_recruter);
225
-					$temps_recrutement = round($obj->temps_recrutement-($obj->temps_recrutement*Bataille::getBatiment()->getNiveauBatiment("caserne")/100));
225
+					$temps_recrutement = round($obj->temps_recrutement - ($obj->temps_recrutement * Bataille::getBatiment()->getNiveauBatiment("caserne") / 100));
226 226
 				}
227 227
 			}
228 228
 
229 229
 			//on test si on a assez de ressource pour recruter les unites
230 230
 			//on test si assez de ressources dans la base
231
-			$retirer_eau = $pour_recruter["eau"]*$nombre;
232
-			$retirer_electricite = $pour_recruter["electricite"]*$nombre;
233
-			$retirer_fer = $pour_recruter["fer"]*$nombre;
234
-			$retirer_fuel = $pour_recruter["fuel"]*$nombre;
231
+			$retirer_eau = $pour_recruter["eau"] * $nombre;
232
+			$retirer_electricite = $pour_recruter["electricite"] * $nombre;
233
+			$retirer_fer = $pour_recruter["fer"] * $nombre;
234
+			$retirer_fuel = $pour_recruter["fuel"] * $nombre;
235 235
 			$eau = Bataille::getTestAssezRessourceBase("eau", $retirer_eau);
236 236
 			$electricite = Bataille::getTestAssezRessourceBase("electricite", $retirer_electricite);
237 237
 			$fer = Bataille::getTestAssezRessourceBase("fer", $retirer_fer);
238 238
 			$fuel = Bataille::getTestAssezRessourceBase("fuel", $retirer_fuel);
239 239
 
240 240
 
241
-			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
241
+			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") {
242 242
 				FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités");
243 243
 				return false;
244 244
 			}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				//on retire les ressources
247 247
 				Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-");
248 248
 
249
-				$date_fin = Bataille::getToday()+($temps_recrutement*$nombre);
249
+				$date_fin = Bataille::getToday() + ($temps_recrutement * $nombre);
250 250
 
251 251
 				$dbc->insert("nom", $nom)
252 252
 					->insert("type", $type)
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 					$type = $obj->type;
278 278
 				}
279 279
 
280
-				for ($i=0 ; $i<$nombre ; $i++) {
280
+				for ($i = 0; $i < $nombre; $i++) {
281 281
 					$dbc->insert("nom", $nom)
282 282
 						->insert("type", $type)
283 283
 						->insert("ID_base", Bataille::getIdBase())
Please login to merge, or discard this patch.
modules/bataille/app/controller/centre_recherche/rechercher.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 	if (isset($_POST['admin'])) {
6 6
 		\core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0);
7
-	}
8
-	else {
7
+	} else {
9 8
 		\core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0);
10 9
 	}
11 10
\ No newline at end of file
Please login to merge, or discard this patch.