Passed
Push — dev ( 9e600d...fc0581 )
by Salim
04:26
created
src/models/Patient_Visit_Manager.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 		if (empty($createdVisitOrder)) {
143 143
 			$lastCreatedVisitOrder=-1;
144
-		}else {
144
+		} else {
145 145
 			$lastCreatedVisitOrder=max($createdVisitOrder);
146 146
 		}
147 147
 
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 
155 155
 			if ($possibleVisit->visitOrder < $lastCreatedVisitOrder) {
156 156
 				$availableVisitName[]=$possibleVisit->name;
157
-			}else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) {
157
+			} else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) {
158 158
 				if ($possibleVisit->optionalVisit) {
159 159
 					//If optional add optional visit and look for the next order
160 160
 					$availableVisitName[]=$possibleVisit->name;
161 161
 					$lastCreatedVisitOrder++;
162
-				}else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) {
162
+				} else if ($possibleVisit->visitOrder > $lastCreatedVisitOrder) {
163 163
 					$availableVisitName[]=$possibleVisit->name;
164 164
 					break;
165 165
 				}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			if (!empty($this->getAvailableVisitsToCreate())) {
187 187
 				return true;
188 188
 			}
189
-		}catch (Exception $e) {
189
+		} catch (Exception $e) {
190 190
 			//if exception happens no visits are missing
191 191
 			return false;
192 192
 		}
@@ -231,20 +231,20 @@  discard block
 block discarded – undo
231 231
 
232 232
 			if ($testedDate >= $dateDownLimit && $testedDate <= $dateDownLimit) {
233 233
 				$visitAnswer['compliancy']=Patient_Visit_Manager::COMPLIANCY_YES;
234
-			}else {
234
+			} else {
235 235
 				$visitAnswer['compliancy']=Patient_Visit_Manager::COMPLIANCY_NO;
236 236
 			}
237
-		}catch (Exception $e) {
237
+		} catch (Exception $e) {
238 238
 			//Visit Not Created
239 239
 			//If optional visit no status determination
240 240
 			if ($visitType->optionalVisit) {
241 241
 				$visitAnswer['status']=Patient_Visit_Manager::OPTIONAL_VISIT;
242
-			}else {
242
+			} else {
243 243
 				//Compare actual time with theorical date to determine status
244 244
 				$testedDate=new DateTime(date("Y-m-d"));
245 245
 				if ($testedDate <= $dateUpLimit) {
246 246
 					$visitAnswer['status']=Patient_Visit_Manager::PENDING;
247
-				}else {
247
+				} else {
248 248
 					$visitAnswer['status']=Patient_Visit_Manager::SHOULD_BE_DONE;
249 249
 				}
250 250
 			}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		if ($this->patientObject->patientWithdraw && $visitAnswer['acquisition_date'] == null) {
255 255
 			if ($this->patientObject->patientWithdrawDate < $dateDownLimit) {
256 256
 				$visitAnswer['status']=Patient_Visit_Manager::VISIT_WITHDRAWN;
257
-			}else if ($this->patientObject->patientWithdrawDate > $dateDownLimit) {
257
+			} else if ($this->patientObject->patientWithdrawDate > $dateDownLimit) {
258 258
 				$visitAnswer['status']=Patient_Visit_Manager::VISIT_POSSIBLY_WITHDRAWN;
259 259
 			}
260 260
 		}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 		if (empty($visitId)) {
297 297
 			throw new Exception("Visit Non Existing");
298
-		}else {
298
+		} else {
299 299
 			return new Visit($visitId, $this->linkpdo);
300 300
 		}
301 301
         
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 		if (empty($visitId)) {
312 312
 			throw new Exception("Visit Non Existing");
313
-		}else {
313
+		} else {
314 314
 			return new Visit($visitId, $this->linkpdo);
315 315
 		}
316 316
 
Please login to merge, or discard this patch.
src/models/Tree.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 	  //Add upload status / user form in class 
46 46
 	  if ($visitObject->statusDone == Visit::DONE && $visitObject->uploadStatus == Visit::NOT_DONE && $visitObject->stateInvestigatorForm != Visit::DONE) {
47 47
 		$class="NotBoth";
48
-	  }else if ($visitObject->statusDone == Visit::DONE && $visitObject->stateInvestigatorForm != Visit::DONE) {
48
+	  } else if ($visitObject->statusDone == Visit::DONE && $visitObject->stateInvestigatorForm != Visit::DONE) {
49 49
 		$class="NotForm";
50
-	  }else if ($visitObject->statusDone == Visit::DONE && $visitObject->uploadStatus == Visit::NOT_DONE) {
50
+	  } else if ($visitObject->statusDone == Visit::DONE && $visitObject->uploadStatus == Visit::NOT_DONE) {
51 51
 		$class="NotUpload";
52
-	  }else {
52
+	  } else {
53 53
 		$class="OK";
54 54
 	  }
55
-	}else if ($this->role == User::CONTROLLER) {
55
+	} else if ($this->role == User::CONTROLLER) {
56 56
 	  if ($visitObject->stateQualityControl == Visit::QC_ACCEPTED || $visitObject->stateQualityControl == Visit::QC_REFUSED) {
57 57
 		$class="OK";
58
-	  }else if ($visitObject->stateQualityControl == Visit::QC_NOT_DONE || $visitObject->stateQualityControl == Visit::QC_WAIT_DEFINITVE_CONCLUSION) {
58
+	  } else if ($visitObject->stateQualityControl == Visit::QC_NOT_DONE || $visitObject->stateQualityControl == Visit::QC_WAIT_DEFINITVE_CONCLUSION) {
59 59
 		$class="NotBoth";
60 60
 	  }
61
-	}else if ($this->role == User::REVIEWER) {
61
+	} else if ($this->role == User::REVIEWER) {
62 62
 	  //Add status of review process (need to remove space from status string)
63 63
 	  $class=str_replace(" ", "", $visitObject->reviewStatus); ;
64 64
 	}
@@ -145,9 +145,13 @@  discard block
 block discarded – undo
145 145
 	$resultTree=[];
146 146
 	foreach ($patientsArray as $patientObject) {
147 147
 	  //If investigator display all created visits
148
-	  if ($this->role == User::INVESTIGATOR) $visitsArray=$patientObject->getAllCreatedPatientsVisits();
148
+	  if ($this->role == User::INVESTIGATOR) {
149
+	  	$visitsArray=$patientObject->getAllCreatedPatientsVisits();
150
+	  }
149 151
 	  //if Reviewer display all QC accepted visits
150
-	  if ($this->role == User::REVIEWER) $visitsArray=$patientObject->getAllQcDonePatientsVisits();
152
+	  if ($this->role == User::REVIEWER) {
153
+	  	$visitsArray=$patientObject->getAllQcDonePatientsVisits();
154
+	  }
151 155
 	  $stortedVisits=$this->processVisitsArray($visitsArray);
152 156
 	  $resultTree[$patientObject->patientCode]['patientObject']=$patientObject;
153 157
 	  $resultTree[$patientObject->patientCode]['modalities']=$stortedVisits;
@@ -206,7 +210,7 @@  discard block
 block discarded – undo
206 210
 	  $patientObjectArray=$this->studyObject->getPatientsLinkedToUserCenters($this->username);
207 211
 
208 212
 	  $treeStructure=$this->makeTreeFromPatients($patientObjectArray);
209
-	}else if ($this->role == User::CONTROLLER) {
213
+	} else if ($this->role == User::CONTROLLER) {
210 214
 
211 215
 	  $controllerVisitsArray=[];
212 216
 
@@ -217,7 +221,7 @@  discard block
 block discarded – undo
217 221
 	  }
218 222
 
219 223
 	  $treeStructure=$this->makeTreeFromVisits($controllerVisitsArray);
220
-	}else if ($this->role == User::MONITOR) {
224
+	} else if ($this->role == User::MONITOR) {
221 225
 
222 226
 	  $monitorVisitsArray=[];
223 227
 
@@ -228,7 +232,7 @@  discard block
 block discarded – undo
228 232
 	  }
229 233
 
230 234
 	  $treeStructure=$this->makeTreeFromVisits($monitorVisitsArray);
231
-	}else if ($this->role == User::REVIEWER) {
235
+	} else if ($this->role == User::REVIEWER) {
232 236
 	  //SK attention une review pending fait reafficher toutes les reviews du patient
233 237
 	  //que soit la modalite
234 238
 	  //peut etre jouer avec le job des users pour filtrer le group de visite
Please login to merge, or discard this patch.
src/models/Session.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 			session_unset(); // unset $_SESSION variable for the run-time
48 48
 			session_destroy(); // destroy session data in storage
49 49
 			self::redirectAndEndScript();
50
-		}else if (empty($_SESSION)) {
50
+		} else if (empty($_SESSION)) {
51 51
 			//if session already empty
52 52
 			self::redirectAndEndScript();
53
-		}else {
53
+		} else {
54 54
 			$_SESSION['LAST_ACTIVITY']=time(); // update last activity time stamp
55 55
 		}
56 56
         
@@ -84,14 +84,16 @@  discard block
 block discarded – undo
84 84
 		//Instanciate PDO connexion with SSL or not
85 85
 		if (DATABASE_SSL) {
86 86
 			$linkpdo=new PDO('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.';charset=UTF8', ''.DATABASE_USERNAME.'', ''.DATABASE_PASSWORD.'', self::getSSLPDOArrayOptions());    
87
-		}else {
87
+		} else {
88 88
 			$linkpdo=new PDO('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.';charset=UTF8', ''.DATABASE_USERNAME.'', ''.DATABASE_PASSWORD.'');   
89 89
 		}
90 90
 
91 91
 		$linkpdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
92 92
         
93 93
 		//Load preferences from the database
94
-		if (!defined('GAELO_PATIENT_CODE_LENGHT')) Session::loadPreferencesInConstants($linkpdo);
94
+		if (!defined('GAELO_PATIENT_CODE_LENGHT')) {
95
+			Session::loadPreferencesInConstants($linkpdo);
96
+		}
95 97
         
96 98
 		return $linkpdo;
97 99
 	}
@@ -121,7 +123,7 @@  discard block
 block discarded – undo
121 123
 			$log->pushHandler(new RotatingFileHandler($_SERVER["DOCUMENT_ROOT"].'/data/logs/gaelO.log', Logger::INFO));
122 124
 			$log->pushProcessor(new WebProcessor());
123 125
 			$log->info($stringInfo);
124
-		}else {
126
+		} else {
125 127
 			error_log("Can't write logs folder");
126 128
 		}
127 129
 	}
Please login to merge, or discard this patch.
src/models/Visit_Type_Iterator.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,11 @@  discard block
 block discarded – undo
37 37
 	public function hasPrevious()
38 38
 	{
39 39
 		$this->previous();
40
-		if ($this->valid()) return $this->current();
41
-		else return false;
40
+		if ($this->valid()) {
41
+			return $this->current();
42
+		} else {
43
+			return false;
44
+		}
42 45
 	}
43 46
 
44 47
 	public function next()
@@ -49,8 +52,11 @@  discard block
 block discarded – undo
49 52
 	public function hasNext()
50 53
 	{
51 54
 		$this->next();
52
-		if ($this->valid()) return $this->current();
53
-		else return false;
55
+		if ($this->valid()) {
56
+			return $this->current();
57
+		} else {
58
+			return false;
59
+		}
54 60
 	}
55 61
 
56 62
 	public function rewind()
Please login to merge, or discard this patch.
src/models/Tracker.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 				'role' => $role
35 35
 			));
36 36
            
37
-		}else {
37
+		} else {
38 38
 			$queryTracker=$linkpdo->prepare('SELECT * FROM tracker WHERE study = :study AND role=:role');
39 39
 			$queryTracker->execute(array('study' => $study,
40 40
 				'role' => $role,
Please login to merge, or discard this patch.
src/models/Dicom_Web_Access.php 1 patch
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,8 +33,11 @@  discard block
 block discarded – undo
33 33
 		$this->userRole=$userRole;
34 34
 		$this->linkpdo=$linkpdo;
35 35
         
36
-		if ($this->endsWith($requestedURI, "/series")) $this->isStudyMetadataRequested=true; 
37
-		else $this->isSerieRequested=true;
36
+		if ($this->endsWith($requestedURI, "/series")) {
37
+			$this->isStudyMetadataRequested=true;
38
+		} else {
39
+			$this->isSerieRequested=true;
40
+		}
38 41
         
39 42
 	}
40 43
     
@@ -55,8 +58,11 @@  discard block
 block discarded – undo
55 58
 	 * @return string
56 59
 	 */
57 60
 	private function getUID() {
58
-		if ($this->isSerieRequested) $level="series";
59
-		else if ($this->isStudyMetadataRequested) $level="studies";
61
+		if ($this->isSerieRequested) {
62
+			$level="series";
63
+		} else if ($this->isStudyMetadataRequested) {
64
+			$level="studies";
65
+		}
60 66
 		$studySubString=strstr($this->requestedURI, "/".$level."/");
61 67
 		$studySubString=str_replace("/".$level."/", "", $studySubString);
62 68
 		$endStudyUIDPosition=strpos($studySubString, "/");
@@ -73,12 +79,16 @@  discard block
 block discarded – undo
73 79
        
74 80
 		if ($this->isSerieRequested) {
75 81
 			$seriesObject=Series_Details::getSerieObjectByUID($uid, $this->linkpdo);
76
-			if ($this->userRole != User::SUPERVISOR && $seriesObject->deleted) throw new Exception('Deleted Series');
82
+			if ($this->userRole != User::SUPERVISOR && $seriesObject->deleted) {
83
+				throw new Exception('Deleted Series');
84
+			}
77 85
 			$studyObject=$seriesObject->studyDetailsObject;
78 86
             
79
-		}else if ($this->isStudyMetadataRequested) {
87
+		} else if ($this->isStudyMetadataRequested) {
80 88
 			$studyObject=Study_Details::getStudyObjectByUID($uid, $this->linkpdo);
81
-			if ($this->userRole != User::SUPERVISOR && $studyObject->deleted) throw new Exception('Deleted Study');
89
+			if ($this->userRole != User::SUPERVISOR && $studyObject->deleted) {
90
+				throw new Exception('Deleted Study');
91
+			}
82 92
 		}
83 93
         
84 94
 		return $studyObject->idVisit;
@@ -98,14 +108,14 @@  discard block
 block discarded – undo
98 108
 		if ($this->userRole == User::REVIEWER || ($this->userRole == User::INVESTIGATOR && $visitObject->uploadStatus == Visit::DONE)) {
99 109
 			//Check that visit is in patient that is still awaiting for some reviews
100 110
 			$visitCheck=$this->userObject->isVisitAllowed($id_visit, $this->userRole);
101
-		}else if ($this->userRole == User::CONTROLLER) {
111
+		} else if ($this->userRole == User::CONTROLLER) {
102 112
 			//Check that QC status still require an action from Controller
103 113
 			if (in_array($visitObject->stateQualityControl, array(Visit::QC_WAIT_DEFINITVE_CONCLUSION, Visit::QC_NOT_DONE))) {
104 114
 				$visitCheck=$this->userObject->isVisitAllowed($id_visit, $this->userRole);
105 115
 			}
106
-		}else if ($this->userRole == User::SUPERVISOR) {
116
+		} else if ($this->userRole == User::SUPERVISOR) {
107 117
 			$visitCheck=$this->userObject->isVisitAllowed($id_visit, $this->userRole);
108
-		}else {
118
+		} else {
109 119
 			//Other roles can't have access to images
110 120
 			$visitCheck=false;
111 121
 		}
Please login to merge, or discard this patch.
src/models/Global_Data.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	public static function getCountryCode(PDO $linkpdo, string $countryName) {
48 48
 		if (GAELO_COUNTRY_LANGUAGE == "FR") {
49 49
 			$request="SELECT country_code FROM country WHERE country_fr = :countryName";
50
-		}else if (GAELO_COUNTRY_LANGUAGE == "US") {
50
+		} else if (GAELO_COUNTRY_LANGUAGE == "US") {
51 51
 			$request="SELECT country_code FROM country WHERE country_us = :countryName";
52 52
 		}
53 53
         
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         
70 70
 		if ($onlyActivated) {
71 71
 			$connecter=$linkpdo->prepare('SELECT name FROM studies WHERE active=1 ORDER BY name');
72
-		}else {
72
+		} else {
73 73
 			$connecter=$linkpdo->prepare('SELECT name FROM studies ORDER BY name');
74 74
 		}
75 75
 		$connecter->execute();
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		try {
241 241
 			if (DATABASE_SSL) {
242 242
 				$dump=new IMysqldump\Mysqldump('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.'', ''.DATABASE_USERNAME.'', ''.DATABASE_PASSWORD.'', array(), Session::getSSLPDOArrayOptions());
243
-			}else {
243
+			} else {
244 244
 				$dump=new IMysqldump\Mysqldump('mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.'', ''.DATABASE_USERNAME.'', ''.DATABASE_PASSWORD.'');   
245 245
 			}
246 246
             
247 247
 			$dump->start($fileSql);
248
-		}catch (Exception $e) {
248
+		} catch (Exception $e) {
249 249
 			echo 'mysqldump-php error: '.$e->getMessage();
250 250
 		}
251 251
 
Please login to merge, or discard this patch.
src/models/User.php 1 patch
Braces   +17 added lines, -14 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
 		//If no match in database => User doesn't exist
77 77
 		if (empty($queryResults)) {
78 78
 			$this->isExistingUser=false;
79
-		}
80
-		else {
79
+		} else {
81 80
 			$this->isExistingUser=true;
82 81
 		}
83 82
         
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
 		//If password delay over 90 => out dated password, need to be changed
131 130
 		if (intVal($delayDay) <= 90) {
132 131
 			$this->passwordDateValide=true;
133
-		}
134
-		else {
132
+		} else {
135 133
 			$this->passwordDateValide=false;
136 134
 		}
137 135
 
@@ -139,7 +137,7 @@  discard block
 block discarded – undo
139 137
 		if ($this->userStatus == User::UNCONFIRMED) {
140 138
 			//Use the temp password for check
141 139
 			$this->passwordCorrect=password_verify($password, $this->tempPassword);
142
-		}else {
140
+		} else {
143 141
 			//use the current password for check
144 142
 			$this->passwordCorrect=password_verify($password, $this->password);
145 143
 		}
@@ -185,7 +183,7 @@  discard block
 block discarded – undo
185 183
 
186 184
 			}
187 185
 		    
188
-		}else {
186
+		} else {
189 187
 			//If blocked status, re-send email notification
190 188
 			if ($this->userStatus == "Blocked") {
191 189
 				$this->sendBlockedEmail();
@@ -244,8 +242,7 @@  discard block
 block discarded – undo
244 242
        
245 243
 		if ($rownb == 0) {
246 244
 			return false;
247
-		}
248
-		else {
245
+		} else {
249 246
 			return true;
250 247
 		}
251 248
 
@@ -326,7 +323,9 @@  discard block
 block discarded – undo
326 323
 	 */
327 324
 	public function isPatientAllowed($patientCode, string $role) {
328 325
         
329
-		if (empty($role)) return false;
326
+		if (empty($role)) {
327
+			return false;
328
+		}
330 329
 
331 330
 		$patientObject=new Patient($patientCode, $this->linkpdo);
332 331
         
@@ -338,7 +337,7 @@  discard block
 block discarded – undo
338 337
 			}
339 338
         
340 339
 		//For other patient's permission is defined by patient's study availabilty
341
-		}else {
340
+		} else {
342 341
 			if ($this->isRoleAllowed($patientObject->patientStudy, $role)) {
343 342
 				return true;
344 343
 			}
@@ -360,21 +359,25 @@  discard block
 block discarded – undo
360 359
 	 */
361 360
 	public function isVisitAllowed($id_visit, string $role) {
362 361
         
363
-		if (empty($role)) return false;
362
+		if (empty($role)) {
363
+			return false;
364
+		}
364 365
         
365 366
 		$visitData=new Visit($id_visit, $this->linkpdo);
366 367
         
367 368
 		//Check that called Role exists for users and visit is not deleted
368 369
 		if ($this->isRoleAllowed($visitData->study, $role) && !$visitData->deleted) {
369 370
 			if ($role == $this::INVESTIGATOR) { 
370
-				if ($this->isPatientAllowed($visitData->patientCode, $role)) return true;
371
-			}else if ($role == $this::REVIEWER) {
371
+				if ($this->isPatientAllowed($visitData->patientCode, $role)) {
372
+					return true;
373
+				}
374
+			} else if ($role == $this::REVIEWER) {
372 375
 				//For reviewer the visit access is allowed if one of the created visits is still awaiting review
373 376
 				//This is made to allow access to references scans
374 377
 				$patientObject=$visitData->getPatient();
375 378
 				$isAwaitingReview=$patientObject->getPatientStudy()->isHavingAwaitingReviewImagingVisit();
376 379
 				return $isAwaitingReview;
377
-			}else {
380
+			} else {
378 381
 				//Controller, Supervisor, Admin, Monitor simply accept when role is available in patient's study (no specific rules)
379 382
 				return true;
380 383
 			}
Please login to merge, or discard this patch.
src/models/Study.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			$documentationQuery=$this->linkpdo->prepare("SELECT id_documentation FROM documentation
206 206
                                                     WHERE study = :study");
207 207
             
208
-		}else {
208
+		} else {
209 209
 			$documentationQuery=$this->linkpdo->prepare("SELECT id_documentation FROM documentation
210 210
                                                     WHERE study = :study
211 211
                                                     AND ".$role."= 1 AND deleted=0");
@@ -294,7 +294,11 @@  discard block
 block discarded – undo
294 294
 		));
295 295
 		$result=$connecter->fetchAll(PDO::FETCH_COLUMN);
296 296
         
297
-		if (count($result) > 0) return false; else return true;
297
+		if (count($result) > 0) {
298
+			return false;
299
+		} else {
300
+			return true;
301
+		}
298 302
         
299 303
 	}
300 304
     
Please login to merge, or discard this patch.