@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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::$values = array_merge(Bataille::$values, ["date_fin_construction" => $this->date_fin_construction-$today]); |
|
265 | + $this->date_fin_construction = $this->date_fin_construction - $today; |
|
266 | + Bataille::$values = array_merge(Bataille::$values, ["date_fin_construction" => $this->date_fin_construction - $today]); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | return 1; |
@@ -310,7 +310,7 @@ discard block |
||
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") |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
376 | 376 | $dbc1 = Bataille::getDb(); |
377 | 377 | |
378 | - $niveau = $niveau+1; |
|
378 | + $niveau = $niveau + 1; |
|
379 | 379 | |
380 | 380 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
381 | 381 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | */ |
409 | 409 | private function getTestBatimentConstruction($nom_batiment) { |
410 | 410 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
411 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
411 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | return [$nom_batiment, false]; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $dbc1 = Bataille::getDb(); |
424 | 424 | |
425 | 425 | //récupération du temps et des ressources pour construire |
426 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
426 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
427 | 427 | |
428 | 428 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
429 | 429 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | |
435 | 435 | //récupération des éléments particulier à un batiment |
436 | 436 | if ($this->nom_batiment_sql == "entrepot") { |
437 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
437 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
438 | 438 | |
439 | - if ((is_array($query)) && (count($query) > 0)){ |
|
439 | + if ((is_array($query)) && (count($query) > 0)) { |
|
440 | 440 | foreach ($query as $obj) { |
441 | - $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
441 | + $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $query = $dbc1->select("ressource_construire") |
494 | 494 | ->select("temps_construction") |
495 | 495 | ->from($this->nom_batiment_sql) |
496 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
496 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
497 | 497 | ->get(); |
498 | 498 | |
499 | 499 | foreach ($query as $obj) { |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | |
504 | 504 | //on insere la construction dans la table batiment si new batiment |
505 | 505 | if ($un_batiment == 0) { |
506 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
506 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
507 | 507 | ->insert("emplacement", $emplacement) |
508 | 508 | ->insert("nom_batiment", $nom_batiment) |
509 | 509 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $this->id_batiment = $dbc->lastInsertId(); |
516 | 516 | } |
517 | 517 | else { |
518 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
518 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
519 | 519 | ->update("construction", 1) |
520 | 520 | ->from("_bataille_batiment") |
521 | 521 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $today = $today->getTimestamp(); |
531 | 531 | |
532 | 532 | //date de la fin de la construction en seconde |
533 | - $fin_construction = $today+$temps_construction; |
|
533 | + $fin_construction = $today + $temps_construction; |
|
534 | 534 | |
535 | 535 | $dbc->insert("date_fin", $fin_construction) |
536 | 536 | ->insert("emplacement_construction", $emplacement) |