Passed
Push — master ( 7c57b8...164b78 )
by Anthony
02:45
created
modules/bataille/app/controller/Batiment.php 5 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   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 		public function getRessourceConstruire() {
47 47
 			return $this->ressource_construire;
48 48
 		}
49
-		public function getInfoBatiment(){
49
+		public function getInfoBatiment() {
50 50
 		    return $this->info_batiment;
51 51
 		}
52
-		public function getInfoBatimentNext(){
52
+		public function getInfoBatimentNext() {
53 53
 			return $this->info_batiment_next;
54 54
 		}
55 55
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			if ((is_array($query)) && (count($query) > 0)) {
82 82
 				foreach ($query as $obj) {
83 83
 					if ($obj->construction == 1) {
84
-						return $obj->niveau-1;
84
+						return $obj->niveau - 1;
85 85
 					}
86 86
 
87 87
 					return $obj->niveau;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			if ($niveau > 0) {
150 150
 				$query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get();
151 151
 
152
-				if ((is_array($query)) && (count($query) > 0)){
152
+				if ((is_array($query)) && (count($query) > 0)) {
153 153
 					foreach ($query as $obj) {
154 154
 						return $obj->stockage;
155 155
 					}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 					$this->niveau_batiment = $this->niveau_batiment + 1;
191 191
 				}
192 192
 				$niveau_batiment_base = $this->niveau_batiment;
193
-				$max_level =  $this->getInfoUpgradeBatiment();
193
+				$max_level = $this->getInfoUpgradeBatiment();
194 194
 			}
195 195
 			else {
196 196
 				//on test voir si le bat est au niveau max et si il peut avoir un addon
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 					$id_batiment = $obj->ID_batiment;
265 265
 				}
266 266
 
267
-				if ($this->date_fin_construction-$today <= 0) {
267
+				if ($this->date_fin_construction - $today <= 0) {
268 268
 					$this->setTerminerConstruction($id_batiment);
269 269
 				}
270 270
 				else {
271 271
 					Bataille::setValues([
272
-						"date_fin_construction" => $this->date_fin_construction-$today,
272
+						"date_fin_construction" => $this->date_fin_construction - $today,
273 273
 						"nom_batiment_construction" => $this->nom_batiment_construction
274 274
 					]);
275 275
 				}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			//et compare la liste des batiments qu'il faut pour construire le batiment
319 319
 			//a ceux qui sont deja construit dans la base
320 320
 			//si tous les batments qu'il faut son batis on autorise la construction du batiment
321
-			for ($i=0 ; $i<$c_all_batiment ; $i++) {
321
+			for ($i = 0; $i < $c_all_batiment; $i++) {
322 322
 				if (!in_array($all_batiment[$i], $batiment_construit)) {
323 323
 					$query = $dbc1->select("pour_construire")
324 324
 						->select("temps_construction")
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 					else if (count($pour_construire) > 1) {
359 359
 						$ok_construction = false;
360 360
 						//test si tous les batiments sont construits et on le niveau nécéssaire
361
-						for ($j=0 ; $j<count($pour_construire) ; $j++) {
361
+						for ($j = 0; $j < count($pour_construire); $j++) {
362 362
 							if (in_array($pour_construire[$j][1], $batiment_construit)) {
363 363
 								if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) {
364 364
 									$ok_construction = true;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) {
403 403
 			$dbc1 = Bataille::getDb();
404 404
 
405
-			$niveau = $niveau+1;
405
+			$niveau = $niveau + 1;
406 406
 
407 407
 			$query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get();
408 408
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		 */
436 436
 		private function getTestBatimentConstruction($nom_batiment) {
437 437
 			if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) {
438
-				return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true];
438
+				return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true];
439 439
 			}
440 440
 
441 441
 			return [$nom_batiment, false];
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			$dbc1 = Bataille::getDb();
451 451
 
452 452
 			//récupération du temps et des ressources pour construire
453
-			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get();
453
+			$query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get();
454 454
 
455 455
 			//si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment
456 456
 			if ((is_array($query)) && (count($query) > 0)) {
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment)
472 472
 						->get();
473 473
 
474
-					if ((is_array($query)) && (count($query) > 0)){
474
+					if ((is_array($query)) && (count($query) > 0)) {
475 475
 						foreach ($query as $obj) {
476 476
 							$this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ;
477 477
 						}
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 					//récupération de la phrase pour le niveau suivant
481 481
 					$query = $dbc1->select($xml->$nom_batiment_sql->champ)
482 482
 						->from($this->nom_batiment_sql)
483
-						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)
483
+						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)
484 484
 						->get();
485 485
 
486
-					if ((is_array($query)) && (count($query) > 0)){
486
+					if ((is_array($query)) && (count($query) > 0)) {
487 487
 						foreach ($query as $obj) {
488 488
 							$this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ;
489 489
 						}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 					$query = $dbc1->select("ressource_construire")
553 553
 						->select("temps_construction")
554 554
 						->from($this->nom_batiment_sql)
555
-						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)
555
+						->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)
556 556
 						->get();
557 557
 
558 558
 					foreach ($query as $obj) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 
563 563
 					//on insere la construction dans la table batiment si new batiment
564 564
 					if ($un_batiment == 0) {
565
-						$dbc->insert("niveau", $this->niveau_batiment+1)
565
+						$dbc->insert("niveau", $this->niveau_batiment + 1)
566 566
 							->insert("emplacement", $emplacement)
567 567
 							->insert("nom_batiment", $nom_batiment)
568 568
 							->insert("nom_batiment_sql", $this->nom_batiment_sql)
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 						$this->id_batiment = $dbc->lastInsertId();
575 575
 					}
576 576
 					else {
577
-						$dbc->update("niveau", $this->niveau_batiment+1)
577
+						$dbc->update("niveau", $this->niveau_batiment + 1)
578 578
 							->update("construction", 1)
579 579
 							->from("_bataille_batiment")
580 580
 							->where("ID_batiment", "=", $this->id_batiment, "AND")
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 					$today = $today->getTimestamp();
590 590
 
591 591
 					//date de la fin de la construction en seconde
592
-					$fin_construction = $today+$temps_construction;
592
+					$fin_construction = $today + $temps_construction;
593 593
 
594 594
 					$dbc->insert("date_fin", $fin_construction)
595 595
 						->insert("emplacement_construction", $emplacement)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 	use core\App;
4 4
 	use core\functions\ChaineCaractere;
5 5
 	use core\HTML\flashmessage\FlashMessage;
6
-	use Nette\Utils\DateTime;
7 6
 
8 7
 	class Batiment {
9 8
 		//pour quand on recup un batiment
Please login to merge, or discard this patch.
Braces   +27 added lines, -34 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 					return $obj->niveau;
93 93
 				}
94
-			}
95
-			else {
94
+			} else {
96 95
 				return 0;
97 96
 			}
98 97
 		}
@@ -109,10 +108,18 @@  discard block
 block discarded – undo
109 108
 				$id_base = Bataille::getIdBase();
110 109
 			}
111 110
 
112
-			if ($ressource == "eau") $nom_batiment = "centrale_eau";
113
-			if ($ressource == "electricite") $nom_batiment = "centrale_electrique";
114
-			if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel";
115
-			if ($ressource == "fer") $nom_batiment = "station_forage";
111
+			if ($ressource == "eau") {
112
+				$nom_batiment = "centrale_eau";
113
+			}
114
+			if ($ressource == "electricite") {
115
+				$nom_batiment = "centrale_electrique";
116
+			}
117
+			if ($ressource == "fuel") {
118
+				$nom_batiment = "station_pompage_fuel";
119
+			}
120
+			if ($ressource == "fer") {
121
+				$nom_batiment = "station_forage";
122
+			}
116 123
 
117 124
 			$niveau = $this->getNiveauBatiment($nom_batiment, $id_base);
118 125
 
@@ -126,8 +133,7 @@  discard block
 block discarded – undo
126 133
 
127 134
 					return $prod;
128 135
 				}
129
-			}
130
-			else {
136
+			} else {
131 137
 				return 20;
132 138
 			}
133 139
 		}
@@ -153,8 +159,7 @@  discard block
 block discarded – undo
153 159
 						return $obj->stockage;
154 160
 					}
155 161
 				}
156
-			}
157
-			else {
162
+			} else {
158 163
 				return 1000;
159 164
 			}
160 165
 		}
@@ -190,8 +195,7 @@  discard block
 block discarded – undo
190 195
 				}
191 196
 				$niveau_batiment_base = $this->niveau_batiment;
192 197
 				$max_level =  $this->getInfoUpgradeBatiment();
193
-			}
194
-			else {
198
+			} else {
195 199
 				$max_level = 0;
196 200
 			}
197 201
 
@@ -244,8 +248,7 @@  discard block
 block discarded – undo
244 248
 
245 249
 				if ($this->date_fin_construction-$today <= 0) {
246 250
 					$this->setTerminerConstruction($id_batiment);
247
-				}
248
-				else {
251
+				} else {
249 252
 					Bataille::setValues([
250 253
 						"date_fin_construction" => $this->date_fin_construction-$today,
251 254
 						"nom_batiment_construction" => $this->nom_batiment_construction
@@ -308,8 +311,7 @@  discard block
 block discarded – undo
308 311
 						foreach ($query as $obj) {
309 312
 							if ($obj->pour_construire != null) {
310 313
 								$pour_construire = unserialize($obj->pour_construire);
311
-							}
312
-							else {
314
+							} else {
313 315
 								$pour_construire = [];
314 316
 							}
315 317
 
@@ -332,21 +334,18 @@  discard block
 block discarded – undo
332 334
 								];
333 335
 							}
334 336
 						}
335
-					}
336
-					else if (count($pour_construire) > 1) {
337
+					} else if (count($pour_construire) > 1) {
337 338
 						$ok_construction = false;
338 339
 						//test si tous les batiments sont construits et on le niveau nécéssaire
339 340
 						for ($j=0 ; $j<count($pour_construire) ; $j++) {
340 341
 							if (in_array($pour_construire[$j][1], $batiment_construit)) {
341 342
 								if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) {
342 343
 									$ok_construction = true;
343
-								}
344
-								else {
344
+								} else {
345 345
 									$ok_construction = false;
346 346
 									break;
347 347
 								}
348
-							}
349
-							else {
348
+							} else {
350 349
 								$ok_construction = false;
351 350
 								break;
352 351
 							}
@@ -363,8 +362,7 @@  discard block
 block discarded – undo
363 362
 								"temps_construction" => $temps_construction
364 363
 							];
365 364
 						}
366
-					}
367
-					else {
365
+					} else {
368 366
 						$ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0);
369 367
 
370 368
 						$batiment_construire[] = [
@@ -473,8 +471,7 @@  discard block
 block discarded – undo
473 471
 							$this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ;
474 472
 						}
475 473
 					}
476
-				}
477
-				else {
474
+				} else {
478 475
 					$this->info_batiment = "";
479 476
 					$this->info_batiment_next = "";
480 477
 				}
@@ -519,8 +516,7 @@  discard block
 block discarded – undo
519 516
 					$ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0);
520 517
 					$this->nom_batiment_sql = $nom_batiment_sql;
521 518
 					$this->niveau_batiment = 0;
522
-				}
523
-				else {
519
+				} else {
524 520
 					//si c'est le lvl 0 de l'addon
525 521
 					if ($this->niveau_batiment == 0) {
526 522
 						$un_batiment = 0;
@@ -531,8 +527,7 @@  discard block
 block discarded – undo
531 527
 				//si pas assez de ressource
532 528
 				if (in_array("rouge", $ressource[0])) {
533 529
 					FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment");
534
-				}
535
-				else {
530
+				} else {
536 531
 					//recuperation du temps de construction
537 532
 					$query = $dbc1->select("ressource_construire")
538 533
 						->select("temps_construction")
@@ -557,8 +552,7 @@  discard block
 block discarded – undo
557 552
 							->set();
558 553
 
559 554
 						$this->id_batiment = $dbc->lastInsertId();
560
-					}
561
-					else {
555
+					} else {
562 556
 						$dbc->update("niveau", $this->niveau_batiment+1)
563 557
 							->update("construction", 1)
564 558
 							->from("_bataille_batiment")
@@ -585,8 +579,7 @@  discard block
 block discarded – undo
585 579
 					//on retire les ressources de la base
586 580
 					Bataille::getRessource()->setUpdateRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1], 0, "-");
587 581
 				}
588
-			}
589
-			else {
582
+			} else {
590 583
 				FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !");
591 584
 			}
592 585
 		}
Please login to merge, or discard this patch.
modules/bataille/app/controller/Bataille.php 4 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   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		public static function getTestAssezRessourceBase($nom_ressource, $ressource) {
198 198
 			$f = "get".ucfirst($nom_ressource);
199 199
 
200
-			if ($ressource >  Bataille::getRessource()->$f()) {
200
+			if ($ressource > Bataille::getRessource()->$f()) {
201 201
 				/*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/
202 202
 				return [
203 203
 					"ressource" => $ressource,
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 			
225 225
 			//calcul des distances séparant les deux bases en x et y
226 226
 			//cette dstance sera multipliée par 15 sur x et y puis ajoutée pour avoir le temps du trajte en seconde
227
-			$calc_x = abs($base_joueur['posx']-$base_autre['posx']);
228
-			$calc_y = abs($base_joueur['posy']-$base_autre['posy']);
227
+			$calc_x = abs($base_joueur['posx'] - $base_autre['posx']);
228
+			$calc_y = abs($base_joueur['posy'] - $base_autre['posy']);
229 229
 			
230
-			$temps_voyage = (($calc_x*70)+($calc_y*70))/$vitesse;
230
+			$temps_voyage = (($calc_x * 70) + ($calc_y * 70)) / $vitesse;
231 231
 			
232 232
 			return $temps_voyage;
233 233
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -9 removed lines patch added patch discarded remove patch
@@ -124,7 +124,9 @@  discard block
 block discarded – undo
124 124
 				->get();
125 125
 
126 126
 			if ((is_array($query)) && (count($query) == 1)) {
127
-				foreach ($query as $obj) return $obj->ID_base;
127
+				foreach ($query as $obj) {
128
+					return $obj->ID_base;
129
+				}
128 130
 			}
129 131
 		}
130 132
 
@@ -169,8 +171,7 @@  discard block
 block discarded – undo
169 171
 
170 172
 			if ($id_base === null) {
171 173
 				$query = $dbc->select()->from("_bataille_last_connexion")->where("ID_identite", "=", self::getIdIdentite())->get();
172
-			}
173
-			else {
174
+			} else {
174 175
 				$query = $dbc->select("_bataille_last_connexion.last_connexion")->from("_bataille_base")
175 176
 					->from("_bataille_last_connexion")
176 177
 					->from("identite")
@@ -272,7 +273,9 @@  discard block
 block discarded – undo
272 273
 				->get();
273 274
 
274 275
 			if ((is_array($query)) && (count($query) == 1)) {
275
-				foreach ($query as $obj) return $obj->ID_base;
276
+				foreach ($query as $obj) {
277
+					return $obj->ID_base;
278
+				}
276 279
 			}
277 280
 
278 281
 			return 0;
@@ -288,7 +291,9 @@  discard block
 block discarded – undo
288 291
 			$query = $dbc->select("nombre_joueur")->from("_bataille_nombre_joueur")->where("ID_nombre_joueur", "=", 1)->get();
289 292
 
290 293
 			if ((is_array($query)) && (count($query) == 1)) {
291
-				foreach ($query as $obj) return $obj->nombre_joueur;
294
+				foreach ($query as $obj) {
295
+					return $obj->nombre_joueur;
296
+				}
292 297
 			}
293 298
 
294 299
 			return 0;
@@ -306,7 +311,9 @@  discard block
 block discarded – undo
306 311
 			$query = $dbc->select($param)->from("configuration")->where("ID_configuration", "=", 1)->get();
307 312
 
308 313
 			if ((is_array($query)) && (count($query) == 1)) {
309
-				foreach ($query as $obj) return $obj->$param;
314
+				foreach ($query as $obj) {
315
+					return $obj->$param;
316
+				}
310 317
 			}
311 318
 		}
312 319
 		//-------------------------- END GETTER ----------------------------------------------------------------------------//
@@ -322,11 +329,12 @@  discard block
 block discarded – undo
322 329
 
323 330
 			if ($id_base === null) {
324 331
 				$id_identite = self::getIdIdentite();
325
-			}
326
-			else {
332
+			} else {
327 333
 				$query = $dbc->select("ID_identite")->from("_bataille_base")->where("ID_base", "=", $id_base)->get();
328 334
 
329
-				foreach ($query as $obj) $id_identite = $obj->ID_identite;
335
+				foreach ($query as $obj) {
336
+					$id_identite = $obj->ID_identite;
337
+				}
330 338
 			}
331 339
 
332 340
 			$dbc->update("last_connexion", date("Y-m-d H:i:s"))
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 		/**
163 163
 		 * @param null $id_base -> sert si definit a recuperer l'id identite de la abse en question
164
-		 * @return mixed
164
+		 * @return string|null
165 165
 		 * recupere la date de la derniere connexion
166 166
 		 */
167 167
 		public static function getLastConnexion($id_base = null) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		/**
191
-		 * @param $nom_ressource
191
+		 * @param string $nom_ressource
192 192
 		 * @param $ressource
193 193
 		 * @return array
194 194
 		 * fonction qui permet de renvyer la couleur rouge si pas assez de ressource pour construire le batiment
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		
214 214
 		/**
215 215
 		 * @param $id_base
216
-		 * @param null $vitesse = vitesse de l'unité en question
216
+		 * @param integer $vitesse = vitesse de l'unité en question
217 217
 		 * @return number
218 218
 		 * fonction qui renvoi le temps de trajet entre la base du joueur et une autre base en secondes
219 219
 		 */
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		/**
298
-		 * @param $param
299
-		 * @return mixed
298
+		 * @param string $param
299
+		 * @return integer
300 300
 		 * fonction qui sert à récupérer un parametre spécifique pour un batiment
301 301
 		 * par exemple la vitesse d'un marchand ou  le nombred'emplacment de la base
302 302
 		 */
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/messagerie/app/controller/Messagerie.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 			return $this->message;
77 77
 		}
78 78
 		public function getDateMessage(){
79
-		    return $this->date_message;
79
+			return $this->date_message;
80 80
 		}
81 81
 		public function getUrl(){
82
-		    return $this->url;
82
+			return $this->url;
83 83
 		}
84 84
 		public function getIdExpediteur() {
85 85
 			return $this->id_expediteur;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			return $this->pseudo_receveur;
95 95
 		}
96 96
 		public function getValues(){
97
-		    return ["messagerie" => $this->values];
97
+			return ["messagerie" => $this->values];
98 98
 		}
99 99
 
100 100
 		/**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 		public function getMessage() {
77 77
 			return $this->message;
78 78
 		}
79
-		public function getDateMessage(){
79
+		public function getDateMessage() {
80 80
 		    return $this->date_message;
81 81
 		}
82
-		public function getUrl(){
82
+		public function getUrl() {
83 83
 		    return $this->url;
84 84
 		}
85 85
 		public function getIdExpediteur() {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		public function getPseudoReceveur() {
95 95
 			return $this->pseudo_receveur;
96 96
 		}
97
-		public function getValues(){
97
+		public function getValues() {
98 98
 		    return ["messagerie" => $this->values];
99 99
 		}
100 100
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				$destinataires = explode(",", $destinataire);
292 292
 				$c = count($destinataires);
293 293
 
294
-				for ($i=0 ; $i<$c ; $i++) {
294
+				for ($i = 0; $i < $c; $i++) {
295 295
 					if ($this->getIdIdentiteExist($destinataires[$i]) !== false) {
296 296
 						$destinataires[] = $this->getIdIdentiteExist($destinataires[$i]);
297 297
 					}
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,11 +33,9 @@  discard block
 block discarded – undo
33 33
 			if ($type_boite !== null) {
34 34
 				if ($type_boite == "boite réception") {
35 35
 					$this->getBoiteReception();
36
-				}
37
-				else if ($type_boite == "messages envoyés") {
36
+				} else if ($type_boite == "messages envoyés") {
38 37
 					$this->getMessagesEnvoyes();
39
-				}
40
-				else if ($type_boite == "messages supprimés") {
38
+				} else if ($type_boite == "messages supprimés") {
41 39
 					$this->getMessageSupprimes();
42 40
 				}
43 41
 
@@ -240,8 +238,7 @@  discard block
 block discarded – undo
240 238
 						"supprimer" => $obj->supprimer
241 239
 					];
242 240
 				}
243
-			}
244
-			else {
241
+			} else {
245 242
 				return false;
246 243
 			}
247 244
 		}
@@ -294,17 +291,14 @@  discard block
 block discarded – undo
294 291
 				for ($i=0 ; $i<$c ; $i++) {
295 292
 					if ($this->getIdIdentiteExist($destinataires[$i]) !== false) {
296 293
 						$destinataires[] = $this->getIdIdentiteExist($destinataires[$i]);
297
-					}
298
-					else {
294
+					} else {
299 295
 						return false;
300 296
 					}
301 297
 				}
302
-			}
303
-			else {
298
+			} else {
304 299
 				if ($this->getIdIdentiteExist($destinataire) !== false) {
305 300
 					$destinataires[] = $this->getIdIdentiteExist($destinataire);
306
-				}
307
-				else {
301
+				} else {
308 302
 					return false;
309 303
 				}
310 304
 			}
Please login to merge, or discard this patch.
admin.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
 	if (isset($_GET['page'])) {
36 36
 		$titre_page = "Administration du site";
37 37
 		$description_page = "Administration du site";
38
-	}
39
-	else {
38
+	} else {
40 39
 		$titre_page = "Administration du site";
41 40
 		$description_page = "Administration du site";
42 41
 	}
@@ -66,25 +65,21 @@  discard block
 block discarded – undo
66 65
 			//si c'est un controleur de base on va cerhcer dans core/admin
67 66
 			if ($core !== false) {
68 67
 				require_once(ROOT.$lien.".php");
69
-			}
70
-			else if ($module !== false) {
68
+			} else if ($module !== false) {
71 69
 				$explode = explode("/", $lien, 3);
72 70
 
73 71
 				require_once(ROOT.$explode[0]."/".$explode[1]."/admin/controller/".$explode[2].".php");
74
-			}
75
-			else {
72
+			} else {
76 73
 				require_once("admin/controller/".$lien.".php");
77 74
 			}
78 75
 		}
79 76
 		//pour la page de login
80 77
 		else if ($page == "login") {
81 78
 			require("admin/views/template/login_admin.php");
82
-		}
83
-		else {
79
+		} else {
84 80
 			if (!isset($_SESSION["idlogin".CLEF_SITE])) {
85 81
 				Connexion::setObgConnecte(WEBROOT."administrator/login");
86
-			}
87
-			else {
82
+			} else {
88 83
 				if (\core\functions\ChaineCaractere::FindInString($page, "modules/") == true) {
89 84
 					//utilisé pour initialiser les modules
90 85
 					$page_module = $page;
@@ -99,8 +94,7 @@  discard block
 block discarded – undo
99 94
 				if (($droit_acces->getDroitAccesPage("gestion-comptes/index") == false) && ($page == "gestion-comptes")) {
100 95
 					FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès");
101 96
 					header("location:".WEBROOT."administrator");
102
-				}
103
-				else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) {
97
+				} else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) {
104 98
 					FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès");
105 99
 					header("location:".WEBROOT."administrator");
106 100
 				}
@@ -108,8 +102,7 @@  discard block
 block discarded – undo
108 102
 				if (($droit_acces->getDroitAccesPage($page) == false) && (!isset($page_module))) {
109 103
 					FlashMessage::setFlash("Vous n'avez pas les droits pour accéder à cette page, contacter votre gérant pour y avoir accès");
110 104
 					header("location:".WEBROOT."administrator");
111
-				}
112
-				else {
105
+				} else {
113 106
 					$cache = new \core\Cache($page, 1);
114 107
 					$admin = new Admin($_SESSION["idlogin".CLEF_SITE]);
115 108
 
@@ -121,14 +114,12 @@  discard block
 block discarded – undo
121 114
 				}
122 115
 			}
123 116
 		}
124
-	}
125
-	else {
117
+	} else {
126 118
 		Connexion::setObgConnecte(WEBROOT."administrator/login");
127 119
 
128 120
 		if (!isset($_SESSION["idlogin".CLEF_SITE])) {
129 121
 			Connexion::setObgConnecte(WEBROOT."administrator/login");
130
-		}
131
-		else {
122
+		} else {
132 123
 			$page = "index";
133 124
 			$admin = new Admin($_SESSION["idlogin".CLEF_SITE]);
134 125
 			require(ROOT."admin/controller/initialise_all.php");
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
 		if ((isset($_GET['page'])) && ($_GET['page'] != null)) {
36 36
 			$page = $_GET['page'];
37 37
 			$contenu->getHeadPage(0, $page);
38
-		}
39
-		else {
38
+		} else {
40 39
 			$contenu->getHeadPage(1);
41 40
 		}
42 41
 
@@ -70,17 +69,14 @@  discard block
 block discarded – undo
70 69
 			//si c'est un controleur de base on va cerhcer dans core/admin
71 70
 			if ($core !== false) {
72 71
 				require_once(ROOT.$lien.".php");
73
-			}
74
-			else if ($module !== false) {
72
+			} else if ($module !== false) {
75 73
 				$explode = explode("/", $lien, 3);
76 74
 
77 75
 				require_once(ROOT.$explode[0]."/".$explode[1]."/app/controller/".$explode[2].".php");
78
-			}
79
-			else {
76
+			} else {
80 77
 				require_once("app/controller/".$lien.".php");
81 78
 			}
82
-		}
83
-		else {
79
+		} else {
84 80
 			$cache = new \core\Cache($page);
85 81
 
86 82
 			$router_module = new RouterModule();
@@ -98,8 +94,7 @@  discard block
 block discarded – undo
98 94
 				echo("<pre>");
99 95
 				print_r($arr);
100 96
 				echo("</pre>");
101
-			}
102
-			else {
97
+			} else {
103 98
 				$contenu->getContenuPage();
104 99
 				$contenu_page = $contenu->getContenu();
105 100
 
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
 			}
123 118
 			$cache->setEnd();
124 119
 		}
125
-	}
126
-	else {
120
+	} else {
127 121
 		$contenu->getContenuPage();
128 122
 		$contenu_page = $contenu->getContenu();
129 123
 
Please login to merge, or discard this patch.
modules/messagerie/router/routes.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.
modules/bataille/router/routes.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.
modules/messagerie/app/controller/message/envoyer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
 
8 8
 	if ($validator->getErrors() !== null) {
9 9
 		\core\HTML\flashmessage\FlashMessage::setFlash($validator->getErrors());
10
-	}
11
-	else {
10
+	} else {
12 11
 		$type = $_POST["type"];
13 12
 		$objet = $_POST['objet']." de la part de ".$_SERVER['HTTP_HOST'];
14 13
 		$demande = $_POST['demande'];
Please login to merge, or discard this patch.