Passed
Push — master ( ec9023...445b57 )
by Anthony
03:13
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.
Spacing   +17 added lines, -17 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
 					}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 				if (($construction[1] == true) && ($this->niveau_batiment > 1)) {
236 236
 					$this->niveau_batiment = $this->niveau_batiment + 1;
237 237
 				}
238
-				$max_level =  $this->getInfoUpgradeBatiment();
238
+				$max_level = $this->getInfoUpgradeBatiment();
239 239
 			}
240 240
 			else {
241 241
 				//on test voir si le bat est au niveau max et si il peut avoir un addon
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 					$id_batiment = $obj->ID_batiment;
308 308
 				}
309 309
 
310
-				if ($this->date_fin_construction-$today <= 0) {
310
+				if ($this->date_fin_construction - $today <= 0) {
311 311
 					$this->setTerminerConstruction($id_batiment);
312 312
 				}
313 313
 				else {
314 314
 					Bataille::setValues([
315
-						"date_fin_construction" => $this->date_fin_construction-$today,
315
+						"date_fin_construction" => $this->date_fin_construction - $today,
316 316
 						"nom_batiment_construction" => $this->nom_batiment_construction
317 317
 					]);
318 318
 				}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			//et compare la liste des batiments qu'il faut pour construire le batiment
362 362
 			//a ceux qui sont deja construit dans la base
363 363
 			//si tous les batments qu'il faut son batis on autorise la construction du batiment
364
-			for ($i=0 ; $i<$c_all_batiment ; $i++) {
364
+			for ($i = 0; $i < $c_all_batiment; $i++) {
365 365
 				if (!in_array($all_batiment[$i], $batiment_construit)) {
366 366
 					$query = $dbc1->select("pour_construire")
367 367
 						->select("temps_construction")
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) {
426 426
 			$dbc1 = Bataille::getDb();
427 427
 
428
-			$niveau = $niveau+1;
428
+			$niveau = $niveau + 1;
429 429
 
430 430
 			$query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get();
431 431
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		 */
459 459
 		private function getTestBatimentConstruction($nom_batiment) {
460 460
 			if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) {
461
-				return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true];
461
+				return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true];
462 462
 			}
463 463
 
464 464
 			return [$nom_batiment, false];
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$dbc1 = Bataille::getDb();
474 474
 
475 475
 			//récupération du temps et des ressources pour construire
476
-			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get();
476
+			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get();
477 477
 
478 478
 			//si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment
479 479
 			if ((is_array($query)) && (count($query) > 0)) {
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 
485 485
 				//récupération des éléments particulier à un batiment
486 486
 				if ($this->nom_batiment_sql == "entrepot") {
487
-					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get();
487
+					$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get();
488 488
 
489
-					if ((is_array($query)) && (count($query) > 0)){
489
+					if ((is_array($query)) && (count($query) > 0)) {
490 490
 						foreach ($query as $obj) {
491
-							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage;
491
+							$this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage;
492 492
 						}
493 493
 					}
494 494
 				}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 					$query = $dbc1->select("ressource_construire")
550 550
 						->select("temps_construction")
551 551
 						->from($this->nom_batiment_sql)
552
-						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)
552
+						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)
553 553
 						->get();
554 554
 
555 555
 					foreach ($query as $obj) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
 					//on insere la construction dans la table batiment si new batiment
561 561
 					if ($un_batiment == 0) {
562
-						$dbc->insert("niveau", $this->niveau_batiment+1)
562
+						$dbc->insert("niveau", $this->niveau_batiment + 1)
563 563
 							->insert("emplacement", $emplacement)
564 564
 							->insert("nom_batiment", $nom_batiment)
565 565
 							->insert("nom_batiment_sql", $this->nom_batiment_sql)
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 						$this->id_batiment = $dbc->lastInsertId();
572 572
 					}
573 573
 					else {
574
-						$dbc->update("niveau", $this->niveau_batiment+1)
574
+						$dbc->update("niveau", $this->niveau_batiment + 1)
575 575
 							->update("construction", 1)
576 576
 							->from("_bataille_batiment")
577 577
 							->where("ID_batiment", "=", $this->id_batiment, "AND")
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 					$today = $today->getTimestamp();
587 587
 
588 588
 					//date de la fin de la construction en seconde
589
-					$fin_construction = $today+$temps_construction;
589
+					$fin_construction = $today + $temps_construction;
590 590
 
591 591
 					$dbc->insert("date_fin", $fin_construction)
592 592
 						->insert("emplacement_construction", $emplacement)
Please login to merge, or discard this patch.
Braces   +27 added lines, -34 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
 		}
@@ -236,8 +240,7 @@  discard block
 block discarded – undo
236 240
 					$this->niveau_batiment = $this->niveau_batiment + 1;
237 241
 				}
238 242
 				$max_level =  $this->getInfoUpgradeBatiment();
239
-			}
240
-			else {
243
+			} else {
241 244
 				//on test voir si le bat est au niveau max et si il peut avoir un addon
242 245
 				if (ChaineCaractere::FindInString($nom_batiment, "addon")) {
243 246
 					$query = $dbc1->select("nom_table")->from("liste_batiment")->where("nom", "=", $nom_batiment)->get();
@@ -250,12 +253,10 @@  discard block
 block discarded – undo
250 253
 						$this->niveau_batiment = 0;
251 254
 
252 255
 						$max_level = $this->getInfoUpgradeBatiment();
253
-					}
254
-					else {
256
+					} else {
255 257
 						$max_level = 0;
256 258
 					}
257
-				}
258
-				else {
259
+				} else {
259 260
 					$max_level = 0;
260 261
 				}
261 262
 			}
@@ -309,8 +310,7 @@  discard block
 block discarded – undo
309 310
 
310 311
 				if ($this->date_fin_construction-$today <= 0) {
311 312
 					$this->setTerminerConstruction($id_batiment);
312
-				}
313
-				else {
313
+				} else {
314 314
 					Bataille::setValues([
315 315
 						"date_fin_construction" => $this->date_fin_construction-$today,
316 316
 						"nom_batiment_construction" => $this->nom_batiment_construction
@@ -373,8 +373,7 @@  discard block
 block discarded – undo
373 373
 						foreach ($query as $obj) {
374 374
 							if ($obj->pour_construire != null) {
375 375
 								$pour_construire = unserialize($obj->pour_construire);
376
-							}
377
-							else {
376
+							} else {
378 377
 								$pour_construire = [];
379 378
 							}
380 379
 
@@ -397,11 +396,9 @@  discard block
 block discarded – undo
397 396
 								];
398 397
 							}
399 398
 						}
400
-					}
401
-					else if (count($pour_construire) > 1) {
399
+					} else if (count($pour_construire) > 1) {
402 400
 						//TODO si besoin de plus d'un seul batiment pour etre construit
403
-					}
404
-					else {
401
+					} else {
405 402
 						$ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0);
406 403
 
407 404
 						$batiment_construire[] = [
@@ -531,8 +528,7 @@  discard block
 block discarded – undo
531 528
 					$ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0);
532 529
 					$this->nom_batiment_sql = $nom_batiment_sql;
533 530
 					$this->niveau_batiment = 0;
534
-				}
535
-				else {
531
+				} else {
536 532
 					//si c'est le lvl 0 de l'addon
537 533
 					if ($this->niveau_batiment == 0) {
538 534
 						$un_batiment = 0;
@@ -543,8 +539,7 @@  discard block
 block discarded – undo
543 539
 				//si pas assez de ressource
544 540
 				if (in_array("rouge", $ressource[0])) {
545 541
 					FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment");
546
-				}
547
-				else {
542
+				} else {
548 543
 					//recuperation du temps de construction
549 544
 					$query = $dbc1->select("ressource_construire")
550 545
 						->select("temps_construction")
@@ -569,8 +564,7 @@  discard block
 block discarded – undo
569 564
 							->set();
570 565
 
571 566
 						$this->id_batiment = $dbc->lastInsertId();
572
-					}
573
-					else {
567
+					} else {
574 568
 						$dbc->update("niveau", $this->niveau_batiment+1)
575 569
 							->update("construction", 1)
576 570
 							->from("_bataille_batiment")
@@ -598,8 +592,7 @@  discard block
 block discarded – undo
598 592
 					//on retire les ressources de la base
599 593
 					Bataille::getRessource()->setRetirerRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1]);
600 594
 				}
601
-			}
602
-			else {
595
+			} else {
603 596
 				FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !");
604 597
 			}
605 598
 		}
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.