Passed
Push — master ( 1c5a7a...282f2b )
by Anthony
04:57
created
core/admin/contenus/GestionContenus.php 2 patches
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 			return $bloc_editable;
34 34
 		}
35 35
 
36
+		/**
37
+		 * @param integer $parent
38
+		 */
36 39
 		private function getOrdrePage($parent) {
37 40
 			if (($parent != "") || ($parent != 0)) {
38 41
 				$dbc = \core\App::getDb();
@@ -66,13 +69,13 @@  discard block
 block discarded – undo
66 69
 		}
67 70
 
68 71
 		/**
69
-		 * @param $nom_table
70
-		 * @param $nom_id_table
71
-		 * @param $champ
72
+		 * @param string $nom_table
73
+		 * @param string $nom_id_table
74
+		 * @param string $champ
72 75
 		 * @param $value
73
-		 * @param $limit_char
74
-		 * @param $err_char
75
-		 * @param $err_egalite
76
+		 * @param integer $limit_char
77
+		 * @param string $err_char
78
+		 * @param string $err_egalite
76 79
 		 * @param null $value_id_table
77 80
 		 * @return string
78 81
 		 * fonction qui permet de vérifier qu'il n'y ait pas d'erreur dans le champ spécifié ni de doublons
Please login to merge, or discard this patch.
Braces   +10 added lines, -15 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 		private function getParentId($parent) {
53 53
 			$dbc = \core\App::getDb();
54 54
 
55
-			if ($parent == "") return 0;
55
+			if ($parent == "") {
56
+				return 0;
57
+			}
56 58
 
57 59
 			$query = $dbc->select("ID_page")->from("page")->where("titre", " LIKE ", '"%'.$parent.'%"', "", true)->get();
58 60
 
@@ -83,8 +85,7 @@  discard block
 block discarded – undo
83 85
 			if (strlen(utf8_decode($value)) > $limit_char) {
84 86
 				$this->erreur = true;
85 87
 				return "<li>$err_char</li>";
86
-			}
87
-			else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) {
88
+			} else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) {
88 89
 				$this->erreur = true;
89 90
 				return "<li>$err_egalite</li>";
90 91
 			}
@@ -167,13 +168,11 @@  discard block
 block discarded – undo
167 168
 					if ($parent == "") {
168 169
 						$this->setAjoutLienNavigation("ID_page", $this->id_page, 1);
169 170
 					}
170
-				}
171
-				else {
171
+				} else {
172 172
 					FlashMessage::setFlash("Impossible de créer cette page, veuillez réeseyer dans un moment. Si le problème persiste contactez votre administrateur.");
173 173
 					$this->erreur = true;
174 174
 				}
175
-			}
176
-			else {
175
+			} else {
177 176
 				$this->setErreurContenus($balise_title, $url, $meta_description, $titre_page, $parent, $err_balise_title, $err_url, $err_meta_description, $err_titre_page);
178 177
 				$this->erreur = true;
179 178
 			}
@@ -219,8 +218,7 @@  discard block
 block discarded – undo
219 218
 				if ($parent == "") {
220 219
 					$this->setAjoutLienNavigation("ID_page", $this->id_page, 1);
221 220
 				}
222
-			}
223
-			else {
221
+			} else {
224 222
 				$this->setErreurContenus($balise_title, $url, $titre_page, $parent, $err_balise_title, $err_url, $err_titre_page);
225 223
 				$this->erreur = true;
226 224
 			}
@@ -284,8 +282,7 @@  discard block
 block discarded – undo
284 282
 						->set();
285 283
 
286 284
 					$this->setModifierLienNavigation("ID_page", $id_page, $this->getParentId($parent), $affiche);
287
-				}
288
-				else {
285
+				} else {
289 286
 					$this->setErreurContenus($balise_title, $url, $meta_description, $titre_page, $parent, $err_balise_title, $err_url, $err_meta_description, $err_titre_page);
290 287
 				}
291 288
 			}
@@ -334,8 +331,7 @@  discard block
 block discarded – undo
334 331
 					FlashMessage::setFlash("Impossible de supprimer cette page, veuillez contacter votre administrateur pour corriger ce problème");
335 332
 					$this->erreur = true;
336 333
 				}
337
-			}
338
-			else {
334
+			} else {
339 335
 				FlashMessage::setFlash("Impossible de supprimer cette page, veuillez contacter votre administrateur pour corriger ce problème");
340 336
 				$this->erreur = true;
341 337
 			}
@@ -361,8 +357,7 @@  discard block
 block discarded – undo
361 357
 			if ($parent != "") {
362 358
 				$nav = new Navigation();
363 359
 				$nav->setSupprimerLien($id, $id_page);
364
-			}
365
-			else if (($affiche == 1) && ($parent == "")) {
360
+			} else if (($affiche == 1) && ($parent == "")) {
366 361
 				$this->setAjoutLienNavigation($id, $id_page, $affiche);
367 362
 			}
368 363
 		}
Please login to merge, or discard this patch.
modules/bataille/app/controller/Aide.php 4 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -123,6 +123,11 @@
 block discarded – undo
123 123
 
124 124
 
125 125
 		//-------------------------- SETTER ----------------------------------------------------------------------------//
126
+
127
+		/**
128
+		 * @param integer[] $niveau_batiment
129
+		 * @param string[] $temps_construction
130
+		 */
126 131
 		private function setListeBatiment($nom_batiment, $nom_batiment_sql, $niveau_batiment, $temps_construction, $ressource, $nom_batiment_construire, $niveau_batiment_construire) {
127 132
 			$this->nom_batiment = $nom_batiment;
128 133
 			$this->nom_batiment_sql = $nom_batiment_sql;
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,25 +87,25 @@
 block discarded – undo
87 87
 
88 88
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
89 89
 		public function getNomBatiment(){
90
-		    return $this->nom_batiment;
90
+			return $this->nom_batiment;
91 91
 		}
92 92
 		public function getNomBatimentSql(){
93
-		    return $this->nom_batiment_sql;
93
+			return $this->nom_batiment_sql;
94 94
 		}
95 95
 		public function getNiveauBatiment(){
96
-		    return $this->niveau_batiment;
96
+			return $this->niveau_batiment;
97 97
 		}
98 98
 		public function getTempsConstruction(){
99
-		    return $this->temps_construction;
99
+			return $this->temps_construction;
100 100
 		}
101 101
 		public function getRessourceConstruire(){
102
-		    return $this->ressource_construire;
102
+			return $this->ressource_construire;
103 103
 		}
104 104
 		public function getNomBatimentConstruire(){
105
-		    return $this->nom_batiment_construire;
105
+			return $this->nom_batiment_construire;
106 106
 		}
107 107
 		public function getNiveauBatimentConstruire(){
108
-		    return $this->niveau_batiment_construire;
108
+			return $this->niveau_batiment_construire;
109 109
 		}
110 110
 
111 111
 		/**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 					}
56 56
 				}
57 57
 
58
-				for ($i=0 ; $i<count($pour_construire) ; $i++) {
58
+				for ($i = 0; $i < count($pour_construire); $i++) {
59 59
 					//si plusieur batiment pour construire le batiment en question
60 60
 					$count = count($pour_construire[$i]);
61 61
 					if ($count > 1) {
62
-						for ($j=0 ; $j<$count ; $j++) {
62
+						for ($j = 0; $j < $count; $j++) {
63 63
 							$temp_nom[] = [$pour_construire[$i][$j][0]];
64 64
 							$temp_niveau[] = [$pour_construire[$i][$j][2]];
65 65
 						}
@@ -86,25 +86,25 @@  discard block
 block discarded – undo
86 86
 
87 87
 
88 88
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
89
-		public function getNomBatiment(){
89
+		public function getNomBatiment() {
90 90
 		    return $this->nom_batiment;
91 91
 		}
92
-		public function getNomBatimentSql(){
92
+		public function getNomBatimentSql() {
93 93
 		    return $this->nom_batiment_sql;
94 94
 		}
95
-		public function getNiveauBatiment(){
95
+		public function getNiveauBatiment() {
96 96
 		    return $this->niveau_batiment;
97 97
 		}
98
-		public function getTempsConstruction(){
98
+		public function getTempsConstruction() {
99 99
 		    return $this->temps_construction;
100 100
 		}
101
-		public function getRessourceConstruire(){
101
+		public function getRessourceConstruire() {
102 102
 		    return $this->ressource_construire;
103 103
 		}
104
-		public function getNomBatimentConstruire(){
104
+		public function getNomBatimentConstruire() {
105 105
 		    return $this->nom_batiment_construire;
106 106
 		}
107
-		public function getNiveauBatimentConstruire(){
107
+		public function getNiveauBatimentConstruire() {
108 108
 		    return $this->niveau_batiment_construire;
109 109
 		}
110 110
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@
 block discarded – undo
69 69
 
70 70
 						$temp_nom = false;
71 71
 						$temp_niveau = false;
72
-					}
73
-					else {
72
+					} else {
74 73
 						$nom_batiment_construire[] = $pour_construire[$i][0][0];
75 74
 						$niveau_batiment_construire[] = $pour_construire[$i][0][2];
76 75
 					}
Please login to merge, or discard this patch.
modules/bataille/app/controller/Batiment.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -368,7 +368,7 @@
 block discarded – undo
368 368
 
369 369
 		/**
370 370
 		 * @param $nom_batiment_sql
371
-		 * @param $niveau
371
+		 * @param integer $niveau
372 372
 		 * @return array
373 373
 		 * recuperation des ressources nécéssaire pour construire le batiment
374 374
 		 */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 			return $this->ressource_construire;
47 47
 		}
48 48
 		public function getInfoBatiment(){
49
-		    return $this->info_batiment;
49
+			return $this->info_batiment;
50 50
 		}
51 51
 
52 52
 		public function getNomBatimentConstruction() {
Please login to merge, or discard this patch.
Braces   +26 added lines, -32 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 					return $obj->niveau;
84 84
 				}
85
-			}
86
-			else {
85
+			} else {
87 86
 				return 0;
88 87
 			}
89 88
 		}
@@ -96,10 +95,18 @@  discard block
 block discarded – undo
96 95
 		public function getProduction($ressource) {
97 96
 			$dbc1 = Bataille::getDb();
98 97
 
99
-			if ($ressource == "eau") $nom_batiment = "centrale_eau";
100
-			if ($ressource == "electricite") $nom_batiment = "centrale_electrique";
101
-			if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel";
102
-			if ($ressource == "fer") $nom_batiment = "station_forage";
98
+			if ($ressource == "eau") {
99
+				$nom_batiment = "centrale_eau";
100
+			}
101
+			if ($ressource == "electricite") {
102
+				$nom_batiment = "centrale_electrique";
103
+			}
104
+			if ($ressource == "fuel") {
105
+				$nom_batiment = "station_pompage_fuel";
106
+			}
107
+			if ($ressource == "fer") {
108
+				$nom_batiment = "station_forage";
109
+			}
103 110
 
104 111
 			$niveau = $this->getNiveauBatiment($nom_batiment);
105 112
 
@@ -120,15 +127,13 @@  discard block
 block discarded – undo
120 127
 						foreach ($query as $obj) {
121 128
 							$prod_addon = $obj->production;
122 129
 						}
123
-					}
124
-					else {
130
+					} else {
125 131
 						$prod_addon = 0;
126 132
 					}
127 133
 
128 134
 					return $prod + $prod_addon;
129 135
 				}
130
-			}
131
-			else {
136
+			} else {
132 137
 				return 20;
133 138
 			}
134 139
 		}
@@ -150,8 +155,7 @@  discard block
 block discarded – undo
150 155
 						return $obj->stockage;
151 156
 					}
152 157
 				}
153
-			}
154
-			else {
158
+			} else {
155 159
 				return 1000;
156 160
 			}
157 161
 		}
@@ -187,8 +191,7 @@  discard block
 block discarded – undo
187 191
 				}
188 192
 
189 193
 				return $this->getInfoUpgradeBatiment();
190
-			}
191
-			else {
194
+			} else {
192 195
 				//on test voir si le bat est au niveau max et si il peut avoir un addon
193 196
 				if (ChaineCaractere::FindInString($nom_batiment, "addon")) {
194 197
 					$query = $dbc1->select("nom_table")->from("liste_batiment")->where("nom", "=", $nom_batiment)->get();
@@ -201,8 +204,7 @@  discard block
 block discarded – undo
201 204
 						$this->niveau_batiment = 0;
202 205
 
203 206
 						return $this->getInfoUpgradeBatiment();
204
-					}
205
-					else {
207
+					} else {
206 208
 						return 0;
207 209
 					}
208 210
 				}
@@ -260,8 +262,7 @@  discard block
 block discarded – undo
260 262
 
261 263
 				if ($this->date_fin_construction-$today <= 0) {
262 264
 					$this->setTerminerConstruction($id_batiment);
263
-				}
264
-				else {
265
+				} else {
265 266
 					$this->date_fin_construction = $this->date_fin_construction-$today;
266 267
 					Bataille::$values = ["date_fin_construction" => $this->date_fin_construction-$today];
267 268
 				}
@@ -322,8 +323,7 @@  discard block
 block discarded – undo
322 323
 						foreach ($query as $obj) {
323 324
 							if ($obj->pour_construire != null) {
324 325
 								$pour_construire = unserialize($obj->pour_construire);
325
-							}
326
-							else {
326
+							} else {
327 327
 								$pour_construire = [];
328 328
 							}
329 329
 
@@ -346,11 +346,9 @@  discard block
 block discarded – undo
346 346
 								];
347 347
 							}
348 348
 						}
349
-					}
350
-					else if (count($pour_construire) > 1) {
349
+					} else if (count($pour_construire) > 1) {
351 350
 						//TODO si besoin de plus d'un seul batiment pour etre construit
352
-					}
353
-					else {
351
+					} else {
354 352
 						$ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0);
355 353
 
356 354
 						$batiment_construire[] = [
@@ -475,8 +473,7 @@  discard block
 block discarded – undo
475 473
 					$ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0);
476 474
 					$this->nom_batiment_sql = $nom_batiment_sql;
477 475
 					$this->niveau_batiment = 0;
478
-				}
479
-				else {
476
+				} else {
480 477
 					//si c'est le lvl 0 de l'addon
481 478
 					if ($this->niveau_batiment == 0) {
482 479
 						$un_batiment = 0;
@@ -487,8 +484,7 @@  discard block
 block discarded – undo
487 484
 				//si pas assez de ressource
488 485
 				if (in_array("rouge", $ressource[0])) {
489 486
 					FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment");
490
-				}
491
-				else {
487
+				} else {
492 488
 					//recuperation du temps de construction
493 489
 					$query = $dbc1->select("ressource_construire")
494 490
 						->select("temps_construction")
@@ -513,8 +509,7 @@  discard block
 block discarded – undo
513 509
 							->set();
514 510
 
515 511
 						$this->id_batiment = $dbc->lastInsertId();
516
-					}
517
-					else {
512
+					} else {
518 513
 						$dbc->update("niveau", $this->niveau_batiment+1)
519 514
 							->update("construction", 1)
520 515
 							->from("_bataille_batiment")
@@ -542,8 +537,7 @@  discard block
 block discarded – undo
542 537
 					//on retire les ressources de la base
543 538
 					Bataille::getRessource()->setRetirerRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1]);
544 539
 				}
545
-			}
546
-			else {
540
+			} else {
547 541
 				FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !");
548 542
 			}
549 543
 		}
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		public function getRessourceConstruire() {
46 46
 			return $this->ressource_construire;
47 47
 		}
48
-		public function getInfoBatiment(){
48
+		public function getInfoBatiment() {
49 49
 		    return $this->info_batiment;
50 50
 		}
51 51
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			if ((is_array($query)) && (count($query) > 0)) {
78 78
 				foreach ($query as $obj) {
79 79
 					if ($obj->construction == 1) {
80
-						return $obj->niveau-1;
80
+						return $obj->niveau - 1;
81 81
 					}
82 82
 
83 83
 					return $obj->niveau;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			if ($niveau > 0) {
146 146
 				$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get();
147 147
 
148
-				if ((is_array($query)) && (count($query) > 0)){
148
+				if ((is_array($query)) && (count($query) > 0)) {
149 149
 					foreach ($query as $obj) {
150 150
 						return $obj->stockage;
151 151
 					}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 				}
184 184
 
185 185
 				if (($construction[1] == true) && ($this->niveau_batiment > 1)) {
186
-					$this->niveau_batiment = $this->niveau_batiment+1;
186
+					$this->niveau_batiment = $this->niveau_batiment + 1;
187 187
 				}
188 188
 
189 189
 				return $this->getInfoUpgradeBatiment();
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 					$id_batiment = $obj->ID_batiment;
259 259
 				}
260 260
 
261
-				if ($this->date_fin_construction-$today <= 0) {
261
+				if ($this->date_fin_construction - $today <= 0) {
262 262
 					$this->setTerminerConstruction($id_batiment);
263 263
 				}
264 264
 				else {
265
-					$this->date_fin_construction = $this->date_fin_construction-$today;
266
-					Bataille::setValues(["date_fin_construction" => $this->date_fin_construction-$today]);
265
+					$this->date_fin_construction = $this->date_fin_construction - $today;
266
+					Bataille::setValues(["date_fin_construction" => $this->date_fin_construction - $today]);
267 267
 				}
268 268
 
269 269
 				return 1;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			//et compare la liste des batiments qu'il faut pour construire le batiment
311 311
 			//a ceux qui sont deja construit dans la base
312 312
 			//si tous les batments qu'il faut son batis on autorise la construction du batiment
313
-			for ($i=0 ; $i<$c_all_batiment ; $i++) {
313
+			for ($i = 0; $i < $c_all_batiment; $i++) {
314 314
 				if (!in_array($all_batiment[$i], $batiment_construit)) {
315 315
 					$query = $dbc1->select("pour_construire")
316 316
 						->select("temps_construction")
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 		private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) {
375 375
 			$dbc1 = Bataille::getDb();
376 376
 
377
-			$niveau = $niveau+1;
377
+			$niveau = $niveau + 1;
378 378
 
379 379
 			$query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get();
380 380
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		 */
408 408
 		private function getTestBatimentConstruction($nom_batiment) {
409 409
 			if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) {
410
-				return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true];
410
+				return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true];
411 411
 			}
412 412
 
413 413
 			return [$nom_batiment, false];
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 			$dbc1 = Bataille::getDb();
423 423
 
424 424
 			//récupération du temps et des ressources pour construire
425
-			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get();
425
+			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get();
426 426
 
427 427
 			//si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment
428 428
 			if ((is_array($query)) && (count($query) > 0)) {
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 
434 434
 				//récupération des éléments particulier à un batiment
435 435
 				if ($this->nom_batiment_sql == "entrepot") {
436
-					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get();
436
+					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get();
437 437
 
438
-					if ((is_array($query)) && (count($query) > 0)){
438
+					if ((is_array($query)) && (count($query) > 0)) {
439 439
 						foreach ($query as $obj) {
440
-							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage;
440
+							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage;
441 441
 						}
442 442
 					}
443 443
 				}
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 					$query = $dbc1->select("ressource_construire")
493 493
 						->select("temps_construction")
494 494
 						->from($this->nom_batiment_sql)
495
-						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)
495
+						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)
496 496
 						->get();
497 497
 
498 498
 					foreach ($query as $obj) {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
 					//on insere la construction dans la table batiment si new batiment
504 504
 					if ($un_batiment == 0) {
505
-						$dbc->insert("niveau", $this->niveau_batiment+1)
505
+						$dbc->insert("niveau", $this->niveau_batiment + 1)
506 506
 							->insert("emplacement", $emplacement)
507 507
 							->insert("nom_batiment", $nom_batiment)
508 508
 							->insert("nom_batiment_sql", $this->nom_batiment_sql)
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 						$this->id_batiment = $dbc->lastInsertId();
515 515
 					}
516 516
 					else {
517
-						$dbc->update("niveau", $this->niveau_batiment+1)
517
+						$dbc->update("niveau", $this->niveau_batiment + 1)
518 518
 							->update("construction", 1)
519 519
 							->from("_bataille_batiment")
520 520
 							->where("ID_batiment", "=", $this->id_batiment, "AND")
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 					$today = $today->getTimestamp();
530 530
 
531 531
 					//date de la fin de la construction en seconde
532
-					$fin_construction = $today+$temps_construction;
532
+					$fin_construction = $today + $temps_construction;
533 533
 
534 534
 					$dbc->insert("date_fin", $fin_construction)
535 535
 						->insert("emplacement_construction", $emplacement)
Please login to merge, or discard this patch.
config/initialise.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if (!isset($page_root)) $page_root = "index.php";
2
+	if (!isset($page_root)) {
3
+		$page_root = "index.php";
4
+	}
3 5
 
4 6
 	//-------------------------- CONSTANTE POUR LES ROUTES ----------------------------------------------------------------------------//
5 7
 	//definit le chemin vers la racine du projet (depuis racine serveur web
@@ -46,15 +48,13 @@  discard block
 block discarded – undo
46 48
 		if (($ini["installation"] == 1) && ($page_root != "installation.php")) {
47 49
 			header("location:".WEBROOT."installation-ribs");
48 50
 		}
49
-	}
50
-	else {
51
+	} else {
51 52
 		header("location:".WEBROOT."installation");
52 53
 	}
53 54
 
54 55
 	if ($ini["developpment"] == 1) {
55 56
 		$tab = "dev";
56
-	}
57
-	else {
57
+	} else {
58 58
 		$tab = "prod";
59 59
 	}
60 60
 
Please login to merge, or discard this patch.
modules/bataille/app/views/aide-detail.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1
-<?php require_once("nav.php");?>
1
+<?php require_once("nav.php"); ?>
2 2
 
3 3
 <h1>Aide sur les <?=\modules\bataille\app\controller\Aide::$batiment?> de type <?=\modules\bataille\app\controller\Aide::$parametre_router?></h1>
4 4
 
5
-<?php for ($i=0 ; $i<$count ; $i++):?>
5
+<?php for ($i = 0; $i < $count; $i++):?>
6 6
 	<div>
7 7
 		<h3><?=$aide->getNomBatiment()[$i]?></h3>
8 8
 		
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 
17 17
 		<?php if (count($aide->getNomBatimentConstruire()[$i]) > 0) :?>
18 18
 			<h4>Batiments nécéssaires pour le premier niveau</h4>
19
-		<?php endif;?>
19
+		<?php endif; ?>
20 20
 
21 21
 		<?php if (count($aide->getNomBatimentConstruire()[$i]) > 1) :?>
22
-			<?php for($x=0 ; $x<count($aide->getNomBatimentConstruire()[$i]) ; $x++): ?>
22
+			<?php for ($x = 0; $x < count($aide->getNomBatimentConstruire()[$i]); $x++): ?>
23 23
 				<ul>
24 24
 					<li>Nom du batiment : <?=$aide->getNomBatimentConstruire()[$i][$x][0]?></li>
25 25
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$i][$x][0]?></li>
26 26
 				</ul>
27
-			<?php endfor;?>
27
+			<?php endfor; ?>
28 28
 		<?php else: ?>
29
-			<?php for ($j=0 ; $j<count($aide->getNomBatimentConstruire()[$i]) ; $j++): ?>
29
+			<?php for ($j = 0; $j < count($aide->getNomBatimentConstruire()[$i]); $j++): ?>
30 30
 				<ul>
31 31
 					<li>Nom du batiment : <?=$aide->getNomBatimentConstruire()[$j]?></li>
32 32
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$j]?></li>
33 33
 				</ul>
34
-			<?php endfor;?>
35
-		<?php endif;?>
34
+			<?php endfor; ?>
35
+		<?php endif; ?>
36 36
 	</div>
37
-<?php endfor;?>
37
+<?php endfor; ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,11 @@
 block discarded – undo
25 25
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$i][$x][0]?></li>
26 26
 				</ul>
27 27
 			<?php endfor;?>
28
-		<?php else: ?>
29
-			<?php for ($j=0 ; $j<count($aide->getNomBatimentConstruire()[$i]) ; $j++): ?>
28
+		<?php else {
29
+	: ?>
30
+			<?php for ($j=0 ;
31
+}
32
+$j<count($aide->getNomBatimentConstruire()[$i]) ; $j++): ?>
30 33
 				<ul>
31 34
 					<li>Nom du batiment : <?=$aide->getNomBatimentConstruire()[$j]?></li>
32 35
 					<li>Niveau du batiment : <?=$aide->getNiveauBatimentConstruire()[$j]?></li>
Please login to merge, or discard this patch.
modules/bataille/app/views/aide.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php require_once("nav.php");?>
1
+<?php require_once("nav.php"); ?>
2 2
 
3 3
 <h1>Bienvenue sur la page d'aide</h1>
4 4
 
Please login to merge, or discard this patch.
modules/bataille/app/controller/Bataille.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 		
25 25
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
26 26
 		public static function getValues() {
27
-		    return ["bataille" => self::$values];
27
+			return ["bataille" => self::$values];
28 28
 		}
29 29
 
30 30
 		//initilisation of all classes of battle
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
 		public static function getTestAssezRessourceBase($nom_ressource, $ressource) {
121 121
 			$f = "get".ucfirst($nom_ressource);
122 122
 
123
-			if ($ressource >  Bataille::getRessource()->$f()) {
123
+			if ($ressource > Bataille::getRessource()->$f()) {
124 124
 				/*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/
125 125
 				return [$ressource, "rouge"];
126 126
 			}
Please login to merge, or discard this patch.
modules/bataille/app/controller/Base.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
17 17
 		public function getBatiments(){
18
-		    return $this->batiments;
18
+			return $this->batiments;
19 19
 		}
20 20
 
21 21
 		/**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
17
-		public function getBatiments(){
17
+		public function getBatiments() {
18 18
 		    return $this->batiments;
19 19
 		}
20 20
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 			$nombre_emplacement = Bataille::getNombreEmplacementBase();
68 68
 
69
-			for ($i=1 ; $i<($nombre_emplacement+1) ; $i++) {
69
+			for ($i = 1; $i < ($nombre_emplacement + 1); $i++) {
70 70
 				$query = $dbc->select()->from("_bataille_batiment")->where("ID_base", "=", Bataille::getIdBase(), "AND")
71 71
 					->where("emplacement", "=", $i)
72 72
 					->orderBy("emplacement")
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 								"niveau" => $obj->niveau,
82 82
 								"emplacement" => $i
83 83
 							];
84
-						}
85
-						else {
84
+						} else {
86 85
 							$batiments[] = [
87 86
 								"nom_batiment" => $obj->nom_batiment,
88 87
 								"nom_batiment_sql" => $obj->nom_batiment_sql,
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
 							];
92 91
 						}
93 92
 					}
94
-				}
95
-				else {
93
+				} else {
96 94
 					$batiments[] = [
97 95
 						"nom_batiment" => "A construire",
98 96
 						"nom_batiment_sql" => "a_construire",
Please login to merge, or discard this patch.
modules/bataille/app/controller/Ressource.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			$last_co = new \DateTime($last_co);
86 86
 			$last_co = $last_co->getTimestamp();
87 87
 
88
-			$diff_temps = $today-$last_co;
88
+			$diff_temps = $today - $last_co;
89 89
 
90 90
 			//si la derniere actualisation ou connexion est supérieur à 30 sec
91 91
 			if ($diff_temps > 180) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) {
106 106
 			$dbc = App::getDb();
107 107
 
108
-			$ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource)/3600)*$diff_temps));
108
+			$ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource) / 3600) * $diff_temps));
109 109
 			$stockage_max = Bataille::getBatiment()->getStockageEntrepot();
110 110
 
111 111
 			if ($ressource > $stockage_max) {
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 		public function setRetirerRessource($eau, $electricite, $fer, $fuel, $nourriture) {
134 134
 			$dbc = App::getDb();
135 135
 
136
-			$eau = $this->getEau()-$eau;
137
-			$electricite = $this->getElectricite()-$electricite;
138
-			$fer = $this->getFer()-$fer;
139
-			$fuel = $this->getFuel()-$fuel;
140
-			$nourriture = $this->getNourriture()-$nourriture;
136
+			$eau = $this->getEau() - $eau;
137
+			$electricite = $this->getElectricite() - $electricite;
138
+			$fer = $this->getFer() - $fer;
139
+			$fuel = $this->getFuel() - $fuel;
140
+			$nourriture = $this->getNourriture() - $nourriture;
141 141
 
142 142
 
143 143
 			$dbc->update("eau", $eau)
Please login to merge, or discard this patch.