Passed
Push — master ( 9ed1fd...287d79 )
by Anthony
02:34
created
modules/bataille/app/controller/Marche.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 			$today = Bataille::getToday();
83 83
 
84 84
 			//on test si déja arrivé à destination
85
-			if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) {
85
+			if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) {
86 86
 				$this->setLivrerRessource();
87 87
 
88 88
 				//on calcul la date d'arrivée du retour
89 89
 				if ($this->id_base_dest == Bataille::getIdBase()) {
90
-					$date_retour = Bataille::getDureeTrajet($this->id_base)+$this->date_arrivee;
90
+					$date_retour = Bataille::getDureeTrajet($this->id_base) + $this->date_arrivee;
91 91
 				}
92 92
 				else {
93
-					$date_retour = Bataille::getDureeTrajet($this->id_base_dest)+$this->date_arrivee;
93
+					$date_retour = Bataille::getDureeTrajet($this->id_base_dest) + $this->date_arrivee;
94 94
 				}
95 95
 
96 96
 				//si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 				}
100 100
 				else {
101 101
 					$this->setTrajetRetour($date_retour);
102
-					$this->duree_restante_trajet = $date_retour-$today;
102
+					$this->duree_restante_trajet = $date_retour - $today;
103 103
 					$set_array = true;
104 104
 				}
105 105
 			}
106
-			else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
106
+			else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) {
107 107
 				$this->setTerminerTransport();
108 108
 			}
109 109
 			else {
110
-				$this->duree_restante_trajet = $this->date_arrivee-$today;
110
+				$this->duree_restante_trajet = $this->date_arrivee - $today;
111 111
 				$set_array = true;
112 112
 			}
113 113
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 			}
160 160
 
161 161
 			//on a le nombre de marchand dispo dans la base
162
-			$nombre_marchand_dispo = $nombre_max_marchand-$marchand_transport;
162
+			$nombre_marchand_dispo = $nombre_max_marchand - $marchand_transport;
163 163
 
164 164
 			//on calcul savoir si on en a assez pour transport toutes les ressoures
165 165
 			//il faut 1 marchand pour 1000 ressource
166
-			$nombre_marchand_trajet = ceil($all_ressource/1000);
166
+			$nombre_marchand_trajet = ceil($all_ressource / 1000);
167 167
 
168 168
 			//si on a assez de marchand on revoi true sinon false
169 169
 			if ($nombre_marchand_dispo >= $nombre_marchand_trajet) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 				}
245 245
 
246 246
 				//on check si assez marchand dans la base, si pas assez on return false
247
-				$nb_marchand = $this->getAssezMarchand($eau+$electricite+$fer+$fuel+$nourriture);
247
+				$nb_marchand = $this->getAssezMarchand($eau + $electricite + $fer + $fuel + $nourriture);
248 248
 
249 249
 				if ($nb_marchand === false) {
250 250
 					FlashMessage::setFlash("Vous n'avez pas assez de marchans disponibles pour effectuer ce trajet");
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 				//sinon initialise le transport
255 255
 				//on recup la date d'arrivee dans la base de destintation
256
-				$date_arrivee = Bataille::getDureeTrajet($id_base_dest)+Bataille::getToday();
256
+				$date_arrivee = Bataille::getDureeTrajet($id_base_dest) + Bataille::getToday();
257 257
 
258 258
 				$ressource = [
259 259
 					"eau" => $eau,
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -88,25 +88,21 @@  discard block
 block discarded – undo
88 88
 				//on calcul la date d'arrivée du retour
89 89
 				if ($this->id_base_dest == Bataille::getIdBase()) {
90 90
 					$date_retour = Bataille::getDureeTrajet($this->id_base)+$this->date_arrivee;
91
-				}
92
-				else {
91
+				} else {
93 92
 					$date_retour = Bataille::getDureeTrajet($this->id_base_dest)+$this->date_arrivee;
94 93
 				}
95 94
 
96 95
 				//si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour
97 96
 				if ($date_retour < $today) {
98 97
 					$this->setTerminerTransport();
99
-				}
100
-				else {
98
+				} else {
101 99
 					$this->setTrajetRetour($date_retour);
102 100
 					$this->duree_restante_trajet = $date_retour-$today;
103 101
 					$set_array = true;
104 102
 				}
105
-			}
106
-			else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
103
+			} else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) {
107 104
 				$this->setTerminerTransport();
108
-			}
109
-			else {
105
+			} else {
110 106
 				$this->duree_restante_trajet = $this->date_arrivee-$today;
111 107
 				$set_array = true;
112 108
 			}
@@ -119,8 +115,7 @@  discard block
 block discarded – undo
119 115
 						"nom_base_dest" => $this->nom_base,
120 116
 						"aller" => $this->aller
121 117
 					];
122
-				}
123
-				else {
118
+				} else {
124 119
 					$marche = [
125 120
 						"id_marche_transport" => $this->id_marche_transport,
126 121
 						"date_arrivee" => $this->duree_restante_trajet,
Please login to merge, or discard this patch.