Passed
Push — master ( a3f1e4...14e4ba )
by Anthony
02:53
created
modules/bataille/app/controller/Batiment.php 1 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.