Passed
Push — master ( 5869f6...fdcc73 )
by Anthony
03:15
created
modules/bataille/app/controller/Points.php 3 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   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
41 41
 			
42 42
 			$query = $dbc->select("points_batiment")->from("configuration")->where("ID_configuration", "=", 1)->get();
43 43
 			
44
-			foreach ($query as $obj) return $obj->points_batiment;
44
+			foreach ($query as $obj) {
45
+				return $obj->points_batiment;
46
+			}
45 47
 		}
46 48
 		//-------------------------- END GETTER ----------------------------------------------------------------------------//
47 49
 		
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 			$dbc = App::getDb();
58 58
 			
59 59
 			if ($type == "batiment") {
60
-				$points = self::getPointsBase($id_base)+self::getPointAjoutBatiment();
60
+				$points = self::getPointsBase($id_base) + self::getPointAjoutBatiment();
61 61
 				
62 62
 			}
63 63
 			
Please login to merge, or discard this patch.
modules/bataille/app/controller/Marche.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -119,6 +119,7 @@
 block discarded – undo
119 119
 
120 120
 		/**
121 121
 		 * fonction qui place le trajet en retour
122
+		 * @param double $date_retour
122 123
 		 */
123 124
 		private function setTrajetRetour($date_retour) {
124 125
 			$dbc = App::getDb();
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,17 +67,14 @@  discard block
 block discarded – undo
67 67
 				//si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour
68 68
 				if ($date_retour < $today) {
69 69
 					$this->setTerminerTransport();
70
-				}
71
-				else {
70
+				} else {
72 71
 					$this->setTrajetRetour($date_retour);
73 72
 					$this->duree_restante_trajet = $date_retour-$today;
74 73
 					$set_array = true;
75 74
 				}
76
-			}
77
-			else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
75
+			} else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
78 76
 				$this->setTerminerTransport();
79
-			}
80
-			else {
77
+			} else {
81 78
 				$this->duree_restante_trajet = $this->date_arrivee-$today;
82 79
 				$set_array = true;
83 80
 			}
@@ -89,8 +86,7 @@  discard block
 block discarded – undo
89 86
 						"date_arrivee" => $this->duree_restante_trajet,
90 87
 						"nom_base_dest" => $this->nom_base
91 88
 					];
92
-				}
93
-				else {
89
+				} else {
94 90
 					$marche["retour"][] = [
95 91
 						"id_marche_transport" => $this->id_marche_transport,
96 92
 						"date_arrivee" => $this->duree_restante_trajet,
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			echo $this->date_arrivee."<br>";
59 59
 
60 60
 			//on test si déja arrivé à destination
61
-			if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) {
61
+			if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) {
62 62
 				$this->setLivrerRessource();
63 63
 
64 64
 				//on calcul la date d'arrivée du retour
65
-				$date_retour = Bataille::getDureeTrajet($this->id_base_dest)+$this->date_arrivee;
65
+				$date_retour = Bataille::getDureeTrajet($this->id_base_dest) + $this->date_arrivee;
66 66
 
67 67
 				//si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour
68 68
 				if ($date_retour < $today) {
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 				}
71 71
 				else {
72 72
 					$this->setTrajetRetour($date_retour);
73
-					$this->duree_restante_trajet = $date_retour-$today;
73
+					$this->duree_restante_trajet = $date_retour - $today;
74 74
 					$set_array = true;
75 75
 				}
76 76
 			}
77
-			else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
77
+			else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) {
78 78
 				$this->setTerminerTransport();
79 79
 			}
80 80
 			else {
81
-				$this->duree_restante_trajet = $this->date_arrivee-$today;
81
+				$this->duree_restante_trajet = $this->date_arrivee - $today;
82 82
 				$set_array = true;
83 83
 			}
84 84
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			}
129 129
 
130 130
 			//on a le nombre de marchand dispo dans la base
131
-			$nombre_marchand_dispo = $nombre_max_marchand-$marchand_transport;
131
+			$nombre_marchand_dispo = $nombre_max_marchand - $marchand_transport;
132 132
 
133 133
 			//on calcul savoir si on en a assez pour transport toutes les ressoures
134 134
 			//il faut 1 marchand pour 1000 ressource
135
-			$nombre_marchand_trajet = ceil($all_ressource/1000);
135
+			$nombre_marchand_trajet = ceil($all_ressource / 1000);
136 136
 
137 137
 			//si on a assez de marchand on revoi true sinon false
138 138
 			if ($nombre_marchand_dispo >= $nombre_marchand_trajet) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				}
214 214
 
215 215
 				//on check si assez marchand dans la base, si pas assez on return false
216
-				$nb_marchand = $this->getAssezMarchand($eau+$electricite+$fer+$fuel+$nourriture);
216
+				$nb_marchand = $this->getAssezMarchand($eau + $electricite + $fer + $fuel + $nourriture);
217 217
 
218 218
 				if ($nb_marchand === false) {
219 219
 					FlashMessage::setFlash("Vous n'avez pas assez de marchans disponibles pour effectuer ce trajet");
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
 				//sinon initialise le transport
224 224
 				//on recup la date d'arrivee dans la base de destintation
225
-				$date_arrivee = Bataille::getDureeTrajet($id_base_dest)+Bataille::getToday();
225
+				$date_arrivee = Bataille::getDureeTrajet($id_base_dest) + Bataille::getToday();
226 226
 
227 227
 				$ressource = [
228 228
 					"eau" => $eau,
Please login to merge, or discard this patch.
modules/bataille/app/controller/Ressource.php 2 patches
Braces   +17 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 			if ($id_base === null) {
19 19
 				$this->id_base = Bataille::getIdBase();
20
-			}
21
-			else {
20
+			} else {
22 21
 				$this->id_base = $id_base;
23 22
 			}
24 23
 
@@ -154,8 +153,7 @@  discard block
 block discarded – undo
154 153
 				$fer = $this->getFer()-$fer;
155 154
 				$fuel = $this->getFuel()-$fuel;
156 155
 				$nourriture = $this->getNourriture()-$nourriture;
157
-			}
158
-			else {
156
+			} else {
159 157
 				$eau = $this->getEau()+$eau;
160 158
 				$electricite = $this->getElectricite()+$electricite;
161 159
 				$fer = $this->getFer()+$fer;
@@ -164,11 +162,21 @@  discard block
 block discarded – undo
164 162
 
165 163
 				$stockage_max = Bataille::getBatiment()->getStockageEntrepot();
166 164
 
167
-				if ($eau > $stockage_max) $eau = $stockage_max;
168
-				if ($electricite > $stockage_max) $electricite = $stockage_max;
169
-				if ($fer > $stockage_max) $fer = $stockage_max;
170
-				if ($fuel > $stockage_max) $fuel = $stockage_max;
171
-				if ($nourriture > $stockage_max) $nourriture = $stockage_max;
165
+				if ($eau > $stockage_max) {
166
+					$eau = $stockage_max;
167
+				}
168
+				if ($electricite > $stockage_max) {
169
+					$electricite = $stockage_max;
170
+				}
171
+				if ($fer > $stockage_max) {
172
+					$fer = $stockage_max;
173
+				}
174
+				if ($fuel > $stockage_max) {
175
+					$fuel = $stockage_max;
176
+				}
177
+				if ($nourriture > $stockage_max) {
178
+					$nourriture = $stockage_max;
179
+				}
172 180
 			}
173 181
 
174 182
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$last_co = new \DateTime($last_co);
98 98
 			$last_co = $last_co->getTimestamp();
99 99
 
100
-			$diff_temps = $today-$last_co;
100
+			$diff_temps = $today - $last_co;
101 101
 
102 102
 			//si la derniere actualisation ou connexion est supérieur à 30 sec
103 103
 			if ($diff_temps > 180) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) {
118 118
 			$dbc = App::getDb();
119 119
 
120
-			$ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base)/3600)*$diff_temps));
120
+			$ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource, $this->id_base) / 3600) * $diff_temps));
121 121
 			$stockage_max = Bataille::getBatiment()->getStockageEntrepot($this->id_base);
122 122
 
123 123
 			if ($ressource > $stockage_max) {
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 
149 149
 			//soit on enelve ou on ajoute
150 150
 			if ($signe == "-") {
151
-				$eau = $this->getEau()-$eau;
152
-				$electricite = $this->getElectricite()-$electricite;
153
-				$fer = $this->getFer()-$fer;
154
-				$fuel = $this->getFuel()-$fuel;
155
-				$nourriture = $this->getNourriture()-$nourriture;
151
+				$eau = $this->getEau() - $eau;
152
+				$electricite = $this->getElectricite() - $electricite;
153
+				$fer = $this->getFer() - $fer;
154
+				$fuel = $this->getFuel() - $fuel;
155
+				$nourriture = $this->getNourriture() - $nourriture;
156 156
 			}
157 157
 			else {
158
-				$eau = $this->getEau()+$eau;
159
-				$electricite = $this->getElectricite()+$electricite;
160
-				$fer = $this->getFer()+$fer;
161
-				$fuel = $this->getFuel()+$fuel;
162
-				$nourriture = $this->getNourriture()+$nourriture;
158
+				$eau = $this->getEau() + $eau;
159
+				$electricite = $this->getElectricite() + $electricite;
160
+				$fer = $this->getFer() + $fer;
161
+				$fuel = $this->getFuel() + $fuel;
162
+				$nourriture = $this->getNourriture() + $nourriture;
163 163
 
164 164
 				$stockage_max = Bataille::getBatiment()->getStockageEntrepot();
165 165
 
Please login to merge, or discard this patch.
modules/bataille/app/controller/marche/envoyer_ressources.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	$marche =  new \modules\bataille\app\controller\Marche();
2
+	$marche = new \modules\bataille\app\controller\Marche();
3 3
 
4 4
 	$marche->setCommencerTransport($_POST['eau'], $_POST['electricite'], $_POST['fer'], $_POST['fuel'], $_POST['nourriture'], $_POST['posx'], $_POST['posy']);
5 5
 
Please login to merge, or discard this patch.
modules/bataille/app/controller/Map.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
 					->from("_bataille_base")
39 39
 					->where("_bataille_base.ID_identite", "=", "identite.ID_identite", "", true)
40 40
 					->get();
41
-			}
42
-			else {
41
+			} else {
43 42
 				$query = $dbc->select("_bataille_base.nom_base")
44 43
 					->select("_bataille_base.points")
45 44
 					->select("_bataille_base.posx")
@@ -114,8 +113,7 @@  discard block
 block discarded – undo
114 113
 			if (Bataille::getNombreJoueur() <= 150) {
115 114
 				$posx = rand(0, 79);
116 115
 				$posy = rand(0, 75);
117
-			}
118
-			else {
116
+			} else {
119 117
 				$posx = rand(0, $this->largeur);
120 118
 				$posy = rand(0, $this->hauteur);
121 119
 			}
@@ -123,8 +121,7 @@  discard block
 block discarded – undo
123 121
 			//on test si il y a une base sur ces positions
124 122
 			if (Bataille::getBaseExistPosition($posx, $posy)) {
125 123
 				$this->getPositionNewBase();
126
-			}
127
-			else {
124
+			} else {
128 125
 				//on a une position de base inexistante donc on la return
129 126
 				return ["posx" => $posx, "posy" => $posy];
130 127
 			}
Please login to merge, or discard this patch.
modules/bataille/app/controller/initialise/index.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.
core/auth/Connexion.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
91 91
 			if (!isset($id)) {
92 92
 				FlashMessage::setFlash("Vos identifiants de connexions sont incorrects");
93 93
 				header("location:$page_retour_err");
94
-			}
95
-			else {
94
+			} else {
96 95
 				self::setTestParamCompte($valide, $archiver, $page_retour_err);
97 96
 
98 97
 				//si les mdp sont egaux on redirige ver esace membre sinon ver login avec un mess d'erreur
@@ -104,8 +103,7 @@  discard block
 block discarded – undo
104 103
 
105 104
 					FlashMessage::setFlash("Vous êtes maintenant connecté", "info");
106 105
 					header("location:$page_retour");
107
-				}
108
-				else {
106
+				} else {
109 107
 					FlashMessage::setFlash("Vos identifiants de connexions sont incorrects");
110 108
 					header("location:$page_retour_err");
111 109
 				}
@@ -135,8 +133,7 @@  discard block
 block discarded – undo
135 133
 				$query = $dbc->select()->from("identite")->where("ID_identite", "=", $auth[0])->get();
136 134
 
137 135
 				self::setTestConnexion($query, $auth, $page_retour);
138
-			}
139
-			else if ((!empty($_SESSION["idlogin".CLEF_SITE])) && (!isset($_COOKIE["auth".CLEF_SITE]))) {
136
+			} else if ((!empty($_SESSION["idlogin".CLEF_SITE])) && (!isset($_COOKIE["auth".CLEF_SITE]))) {
140 137
 				$id_identite = $_SESSION["idlogin".CLEF_SITE];
141 138
 				$membre = new Membre($id_identite);
142 139
 
@@ -184,7 +181,9 @@  discard block
 block discarded – undo
184 181
 			$dbc = App::getDb();
185 182
 			$query = $dbc->select("last_change_mdp")->from("identite")->where("ID_identite", "=", $id_identite)->get();
186 183
 			if ((is_array($query)) && (count($query) > 0)) {
187
-				foreach ($query as $obj) return $obj->last_change_mdp;
184
+				foreach ($query as $obj) {
185
+					return $obj->last_change_mdp;
186
+				}
188 187
 			}
189 188
 		}
190 189
 
Please login to merge, or discard this patch.