Passed
Push — master ( 760f14...760f14 )
by Anthony
02:43
created
modules/bataille/app/controller/Unite.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 		//-------------------------- SETTER ----------------------------------------------------------------------------//
50 50
 		/**
51 51
 		 * @param $id_base
52
-		 * @param $type
52
+		 * @param string $type
53 53
 		 * fonction qui ajoute des points à la base en fonction du type
54 54
 		 * le type peut etre : batiment, attaque, defense, troupe
55 55
 		 */
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 			$query = $dbc1->select("coef_niveau_unite")->from("configuration")->where("ID_configuration", "=", 1)->get();
20 20
 
21 21
 			if ((is_array($query)) && (count($query) == 1)) {
22
-				foreach ($query as $obj) $this->coef_unite = $obj->coef_niveau_unite;
22
+				foreach ($query as $obj) {
23
+					$this->coef_unite = $obj->coef_niveau_unite;
24
+				}
23 25
 			}
24 26
 		}
25 27
 		//-------------------------- END BUILDER ----------------------------------------------------------------------------//
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 				$coef = $this->coef_unite*$niveau;
54 56
 				$coef_ameliorer = $this->coef_unite*($niveau+1);
55 57
 
56
-				if ($niveau == 1) $coef = 1;
58
+				if ($niveau == 1) {
59
+					$coef = 1;
60
+				}
57 61
 
58 62
 				return [
59 63
 					"caracteristique" => [
@@ -76,8 +80,7 @@  discard block
 block discarded – undo
76 80
 					],
77 81
 					"temps_recrutement" => $temps_recrutement
78 82
 				];
79
-			}
80
-			else {
83
+			} else {
81 84
 				return [];
82 85
 			}
83 86
 		}
@@ -115,8 +118,7 @@  discard block
 block discarded – undo
115 118
 				foreach ($query as $obj) {
116 119
 					if ($obj->date_fin-$today <= 0) {
117 120
 						$this->setTerminerRecrutement($obj->ID_recrutement);
118
-					}
119
-					else {
121
+					} else {
120 122
 						$recrutement[] = [
121 123
 							"nom" => $obj->nom,
122 124
 							"type" => $obj->type,
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
 		 */
138 140
 		public function getAllUnites($id_base = null) {
139 141
 
140
-			if ($id_base == null) $id_base = Bataille::getIdBase();
142
+			if ($id_base == null) {
143
+				$id_base = Bataille::getIdBase();
144
+			}
141 145
 
142 146
 			$unite_infanterie = $this->getAllUniteType("unité infanterie", $id_base);
143 147
 			$unite_vehicule = $this->getAllUniteType("unité véhicule", $id_base);
@@ -218,8 +222,7 @@  discard block
 block discarded – undo
218 222
 			if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) {
219 223
 				FlashMessage::setFlash("Pas assez de ressources pour recruter autant d'unités");
220 224
 				return false;
221
-			}
222
-			else {
225
+			} else {
223 226
 				//on retire les ressources
224 227
 				Bataille::getRessource()->setUpdateRessource($retirer_eau, $retirer_electricite, $retirer_fer, $retirer_fuel, 0, "-");
225 228
 
@@ -254,7 +257,9 @@  discard block
 block discarded – undo
254 257
 					$type = $obj->type;
255 258
 				}
256 259
 
257
-				if ($type == "unité infanterie") $table = "_bataille_unite";
260
+				if ($type == "unité infanterie") {
261
+					$table = "_bataille_unite";
262
+				}
258 263
 
259 264
 				for ($i=0 ; $i<$nombre ; $i++) {
260 265
 					$dbc->insert("nom_unite", $type)
Please login to merge, or discard this patch.