Passed
Push — master ( 9e08b1...d0105f )
by Salim
08:36
created
src/controllers/investigator/visit_interface_controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
 	require 'includes/table_visit.php';
41 41
 	require 'views/investigator/visit_interface_view.php';
42 42
    
43
-} else {
43
+}else {
44 44
 	require 'includes/no_access.php';
45 45
 }
Please login to merge, or discard this patch.
src/controllers/supervisor/review_manager_controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     
50 50
 	require 'views/supervisor/review_manager_view.php';
51 51
     
52
-} else {
52
+}else {
53 53
     
54 54
 	require 'includes/no_access.php';
55 55
 }
Please login to merge, or discard this patch.
src/models/FTP_Reader.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 			$isAvailable=$this->isSearchedFileAvailable($fileArray);
78 78
 			if ($isAvailable) {
79 79
 				return array($this->ftpFileName);
80
-			}else {
80
+			} else {
81 81
 				throw new Exception('Target File Not Found');
82 82
 			}
83
-		}else {
83
+		} else {
84 84
 			return $fileArray;
85 85
 		}
86 86
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if ($this->ftpIsSftp) {
113 113
 
114 114
 			$filesArray=$this->getSftp();
115
-		}else {
115
+		} else {
116 116
 			$filesArray=$this->getFtp();
117 117
 			//$ftpConnect = ftp_ssl_connect ($this->ftpHost, $this->ftpPort) or die("Can't Connect to Server ".$this->ftpHost);
118 118
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 			return $sftp;
138 138
 
139
-		}else {
139
+		} else {
140 140
 
141 141
 			if (!$ftpConnect=ftp_connect($this->ftpHost, $this->ftpPort)) {
142 142
 				throw new Exception('Cant Connect to Server'.$this->ftpHost);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 			return $result;
171 171
 
172
-		}else {      
172
+		} else {      
173 173
 
174 174
 			$ftp=$this->connectAndGoToFolder();
175 175
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		$fileArray=array_filter($fileArray, function($file) {
192 192
 			if ($file == '.' || $file == '..') {
193 193
 				return false;
194
-			}else {
194
+			} else {
195 195
 				return true;
196 196
 			}
197 197
 		});
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$fileArray=array_filter($fileArray, function($file) {
231 231
 			if ($file == '.' || $file == '..') {
232 232
 				return false;
233
-			}else {
233
+			} else {
234 234
 				return true;
235 235
 			}
236 236
 		});
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			if ($i == 0) {
275 275
 				//First line is column definition
276 276
 				$titles=$columns;
277
-			}else {
277
+			} else {
278 278
 				$patient=[];
279 279
 				//For each column associate data into an associative array
280 280
 				for ($j=0; $j < sizeof($columns); $j++) {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			$email->setSubject('Auto Import Failed');
296 296
 			$email->addAminEmails();
297 297
 			$email->sendEmail();
298
-		}catch (Exception $e) {
298
+		} catch (Exception $e) {
299 299
 			echo('sendEmailException');
300 300
 			echo($e->getMessage());
301 301
 		}
Please login to merge, or discard this patch.
src/controllers/investigator/controller_form_controller.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 		if (isset($_POST['ask_corrective_action'])) {
57 57
 			$controlDecision=Visit::QC_CORRECTIVE_ACTION_ASKED;
58 58
 			//Make Investigator Form as Draft and update form status in visit
59
-			if($visitObject->getVisitCharacteristics()->localFormNeeded){
59
+			if ($visitObject->getVisitCharacteristics()->localFormNeeded) {
60 60
 
61 61
 				try {
62 62
 					$localReviewObject=$visitObject->getReviewsObject(true);
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 				try {
62 62
 					$localReviewObject=$visitObject->getReviewsObject(true);
63 63
 					$localReviewObject->unlockForm();
64
-				}catch (Exception $e) {
64
+				} catch (Exception $e) {
65 65
 					error_log($e->getMessage());
66 66
 				}
67 67
 	
@@ -91,25 +91,25 @@  discard block
 block discarded – undo
91 91
 		//Changing Boolean in text to send email
92 92
 		if ($formAccepted) {
93 93
 			$formAccepted="Accepted";
94
-		}else {
94
+		} else {
95 95
 			$formAccepted="Refused";
96 96
 		}
97 97
         
98 98
 		if ($imageAccepted) {
99 99
 			$imageAccepted="Accepted";
100
-		}else {
100
+		} else {
101 101
 			$imageAccepted="Refused";
102 102
 		}
103 103
         
104 104
 		if (empty($_POST['formComment'])) {
105 105
 			$commentForm="N/A";
106
-		}else {
106
+		} else {
107 107
 			$commentForm=$_POST['formComment'];
108 108
 		}
109 109
         
110 110
 		if (empty($_POST['imageComment'])) {
111 111
 			$commentImage="N/A";
112
-		}else {
112
+		} else {
113 113
 			$commentImage=$_POST['imageComment'];
114 114
 		}
115 115
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
         
125 125
 
126 126
 	  //if send form with uncorrect permission, refuse
127
-	  }else if (isset($_POST['refuse']) || isset($_POST['accept']) || isset($_POST['ask_corrective_action'])
127
+	  } else if (isset($_POST['refuse']) || isset($_POST['accept']) || isset($_POST['ask_corrective_action'])
128 128
 			   && $role != User::CONTROLLER
129 129
 		  && (!in_array($visitObject->stateQualityControl, array(Visit::QC_NOT_DONE, Visit::QC_WAIT_DEFINITVE_CONCLUSION)))) {
130 130
            
131 131
 		  print("No Access");        
132 132
            
133
-	  }else {
133
+	  } else {
134 134
 		//if No form submitted, display the html form +- results
135 135
 		$visitType=$visitObject->getVisitCharacteristics();
136 136
 		require 'views/investigator/controller_form_view.php';
137 137
 	}
138
-}else {
138
+} else {
139 139
 	require 'includes/no_access.php';
140 140
 }
Please login to merge, or discard this patch.
src/scripts/remove_review_attached_file.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 		die('Delete File Error');
42 42
 	}
43 43
 
44
-	echo( json_encode((true)) );
44
+	echo(json_encode((true)));
45 45
 
46 46
 }else {
47 47
 	header('HTTP/1.0 403 Forbidden');
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,19 +31,22 @@
 block discarded – undo
31 31
 
32 32
 if ($accessCheck && in_array($_SESSION['role'], array(User::INVESTIGATOR, User::REVIEWER))) {
33 33
 
34
-	if ($_SESSION['role'] == User::INVESTIGATOR) $reviewObject=$visitObject->getReviewsObject(true);
35
-	else $reviewObject=$visitObject->queryExistingReviewForReviewer($_SESSION['username']);
34
+	if ($_SESSION['role'] == User::INVESTIGATOR) {
35
+		$reviewObject=$visitObject->getReviewsObject(true);
36
+	} else {
37
+		$reviewObject=$visitObject->queryExistingReviewForReviewer($_SESSION['username']);
38
+	}
36 39
 
37 40
 	try {
38 41
 		$reviewObject->deleteAssociatedFile($fileKey);
39
-	}catch (Exception $e) {
42
+	} catch (Exception $e) {
40 43
 		header('HTTP/1.0 403 Forbidden');
41 44
 		die('Delete File Error');
42 45
 	}
43 46
 
44 47
 	echo( json_encode((true)) );
45 48
 
46
-}else {
49
+} else {
47 50
 	header('HTTP/1.0 403 Forbidden');
48 51
 	die('You are not allowed to access this file.');
49 52
 }
50 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/scripts/add_review_attached_file.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
 	$fileMime=$_FILES['files']['type'][0];
45 45
 	$tempFileLocation=$_FILES['files']['tmp_name'][0];
46 46
 	$fileSize=$_FILES['files']['size'][0];
47
-	try{
47
+	try {
48 48
 		$formProcessor->storeAssociatedFile($fileKey, $fileMime, $fileSize, $tempFileLocation);
49
-		echo( json_encode((true)) );
50
-	}catch (Throwable $t){
51
-		echo (json_encode((false)) );
49
+		echo(json_encode((true)));
50
+	}catch (Throwable $t) {
51
+		echo (json_encode((false)));
52 52
 	}
53 53
 
54 54
 }else {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
 	try{
48 48
 		$formProcessor->storeAssociatedFile($fileKey, $fileMime, $fileSize, $tempFileLocation);
49 49
 		echo( json_encode((true)) );
50
-	}catch (Throwable $t){
50
+	} catch (Throwable $t){
51 51
 		echo (json_encode((false)) );
52 52
 	}
53 53
 
54
-}else {
54
+} else {
55 55
 	header('HTTP/1.0 403 Forbidden');
56 56
 	die('You are not allowed to access this file.');
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
src/scripts/is_review_attached_file.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,17 +31,20 @@
 block discarded – undo
31 31
 if ($accessCheck && in_array($_SESSION['role'], array(User::INVESTIGATOR, User::REVIEWER))) {
32 32
 
33 33
 	try {
34
-		if ($_SESSION['role'] == User::INVESTIGATOR) $reviewObject=$visitObject->getReviewsObject(true);
35
-		else $reviewObject=$visitObject->queryExistingReviewForReviewer($_SESSION['username']);
34
+		if ($_SESSION['role'] == User::INVESTIGATOR) {
35
+			$reviewObject=$visitObject->getReviewsObject(true);
36
+		} else {
37
+			$reviewObject=$visitObject->queryExistingReviewForReviewer($_SESSION['username']);
38
+		}
36 39
 		$filePath=$reviewObject->getAssociatedFilePath($fileKey);
37 40
 		$answer=is_file($filePath);
38
-	}catch (Exception $e) {
41
+	} catch (Exception $e) {
39 42
 		$answer=false;
40 43
 	}
41 44
 
42 45
 	echo(json_encode($answer));
43 46
 
44
-}else {
47
+} else {
45 48
 	header('HTTP/1.0 403 Forbidden');
46 49
 	die('You are not allowed to access this file.');
47 50
 }
48 51
\ No newline at end of file
Please login to merge, or discard this patch.
src/models/Review.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		));
41 41
 		$reviewData=$dataFetcher->fetch(PDO::FETCH_ASSOC);
42 42
 
43
-		if(empty($reviewData)) throw new Exception('No Review '.$id_review.' found');
43
+		if (empty($reviewData)) throw new Exception('No Review '.$id_review.' found');
44 44
         
45 45
 		$this->id_visit=$reviewData['id_visit'];
46 46
 		$this->username=$reviewData['username'];
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function getAssociatedFilePath(string $fileKey) : String {
185 185
 		$fileArray=$this->associatedFiles;
186
-		if(array_key_exists($fileKey, $fileArray)){
186
+		if (array_key_exists($fileKey, $fileArray)) {
187 187
 			return $this->getAssociatedFileRootPath().'/'.$fileArray[$fileKey];
188
-		} else {
188
+		}else {
189 189
 			throw new Exception('Non Existing Key');
190 190
 		}
191 191
 		
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	public function deleteAssociatedFile($fileKey) {
195 195
 
196 196
 		if (!$this->validated) {
197
-			$filePath = $this->getAssociatedFilePath($fileKey);
198
-			if( ! is_file( $filePath ) ) throw new Exception('No File To Delete');
199
-			unlink( $filePath );
197
+			$filePath=$this->getAssociatedFilePath($fileKey);
198
+			if (!is_file($filePath)) throw new Exception('No File To Delete');
199
+			unlink($filePath);
200 200
 			unset($this->associatedFiles[$fileKey]);
201 201
 			$this->updateAssociatedFiles($this->associatedFiles);
202 202
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 		));
41 41
 		$reviewData=$dataFetcher->fetch(PDO::FETCH_ASSOC);
42 42
 
43
-		if(empty($reviewData)) throw new Exception('No Review '.$id_review.' found');
43
+		if(empty($reviewData)) {
44
+			throw new Exception('No Review '.$id_review.' found');
45
+		}
44 46
         
45 47
 		$this->id_visit=$reviewData['id_visit'];
46 48
 		$this->username=$reviewData['username'];
@@ -109,7 +111,7 @@  discard block
 block discarded – undo
109 111
 		if ($this->isLocal) {
110 112
 			$visitObject->resetQC();
111 113
 			$visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_NOT_DONE);
112
-		}else {
114
+		} else {
113 115
 			$formProcessor=$visitObject->getFromProcessor($this->isLocal, $this->username);
114 116
 			$formProcessor->setVisitValidation();
115 117
 		}
@@ -162,7 +164,7 @@  discard block
 block discarded – undo
162 164
         
163 165
 		if ($result) {
164 166
 			return $finalFilename;
165
-		}else {
167
+		} else {
166 168
 			throw New Exception('Error writing associated File');
167 169
 		}
168 170
         
@@ -195,12 +197,14 @@  discard block
 block discarded – undo
195 197
 
196 198
 		if (!$this->validated) {
197 199
 			$filePath = $this->getAssociatedFilePath($fileKey);
198
-			if( ! is_file( $filePath ) ) throw new Exception('No File To Delete');
200
+			if( ! is_file( $filePath ) ) {
201
+				throw new Exception('No File To Delete');
202
+			}
199 203
 			unlink( $filePath );
200 204
 			unset($this->associatedFiles[$fileKey]);
201 205
 			$this->updateAssociatedFiles($this->associatedFiles);
202 206
 
203
-		}else {
207
+		} else {
204 208
 			throw new Exception('Validated Review, can\'t remove file');
205 209
 		}
206 210
 
@@ -233,7 +237,7 @@  discard block
 block discarded – undo
233 237
         
234 238
 		if ($this->isLocal) {
235 239
 			$visitObject->changeVisitStateInvestigatorForm(Visit::LOCAL_FORM_DRAFT);
236
-		}else {
240
+		} else {
237 241
 			$formProcessor=$visitObject->getFromProcessor($this->isLocal, $this->username);
238 242
 			$formProcessor->setVisitValidation();
239 243
 		}
Please login to merge, or discard this patch.
src/models/Export_Study_Data.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			foreach ($reviewsObjects as $reviewObject) {
84 84
 
85 85
 				foreach ($reviewObject->associatedFiles as $associatedFileKey => $associatedFilePath) {
86
-					$associatedFileLocation = $reviewObject->getAssociatedFilePath($associatedFileKey);
86
+					$associatedFileLocation=$reviewObject->getAssociatedFilePath($associatedFileKey);
87 87
 					$zip->addFile($associatedFileLocation);
88 88
 
89 89
 				};
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 		$reviewDatas=$this->getGenericData($review);
257 257
 		$specificData=$review->getSpecificData();
258 258
 		unset($specificData["id_review"]);
259
-		$specificDataArray = [];
260
-		if( !empty($specificData) ){
261
-			$specificDataArray = array_values($specificData);
259
+		$specificDataArray=[];
260
+		if (!empty($specificData)) {
261
+			$specificDataArray=array_values($specificData);
262 262
 		}
263 263
 		$reviewLine=[...$reviewDatas, ...$specificDataArray];
264 264
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			try {
39 39
 				$modalityCreatedVisit=$this->studyObject->getStudySpecificGroupManager($visitGroup->groupModality)->getCreatedVisits();
40 40
 				array_push($this->allcreatedVisits, ...$modalityCreatedVisit);
41
-			}catch (Exception $e) { }
41
+			} catch (Exception $e) { }
42 42
 		}
43 43
 	}
44 44
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		$localReviews=[];
216 216
 		try {
217 217
 			$localReviews[]=$visitObject->getReviewsObject(true);
218
-		}catch (Exception $e) { }
218
+		} catch (Exception $e) { }
219 219
 
220 220
 		$expertReviews=[];
221 221
 		try {
222 222
 			$expertReviews=$visitObject->getReviewsObject(false, true);
223
-		}catch (Exception $e) { }
223
+		} catch (Exception $e) { }
224 224
 
225 225
 		//Merge all reviews in an array
226 226
 		$reviewObjects=array_merge($localReviews, $expertReviews);
@@ -318,29 +318,29 @@  discard block
 block discarded – undo
318 318
 
319 319
 		if ($visitObject->statusDone == Visit::NOT_DONE) {
320 320
 			return 0;
321
-		}else if ($visitObject->uploadStatus == Visit::NOT_DONE || $visitObject->stateInvestigatorForm == Visit::NOT_DONE) {
321
+		} else if ($visitObject->uploadStatus == Visit::NOT_DONE || $visitObject->stateInvestigatorForm == Visit::NOT_DONE) {
322 322
 			if ($visitObject->uploadStatus == Visit::NOT_DONE && $visitObject->stateInvestigatorForm == Visit::NOT_DONE) {
323 323
 				return 1;
324
-			}else if ($visitObject->stateInvestigatorForm == Visit::NOT_DONE) {
324
+			} else if ($visitObject->stateInvestigatorForm == Visit::NOT_DONE) {
325 325
 				return 3;
326
-			}else if ($visitObject->uploadStatus == Visit::NOT_DONE) {
326
+			} else if ($visitObject->uploadStatus == Visit::NOT_DONE) {
327 327
 				return 2;
328 328
 			}
329
-		}else if ($visitObject->qcStatus == Visit::QC_NOT_DONE) {
329
+		} else if ($visitObject->qcStatus == Visit::QC_NOT_DONE) {
330 330
 			return 4;
331
-		}else if ($visitObject->qcStatus == Visit::QC_CORRECTIVE_ACTION_ASKED) {
331
+		} else if ($visitObject->qcStatus == Visit::QC_CORRECTIVE_ACTION_ASKED) {
332 332
 			return 5;
333
-		}else if ($visitObject->qcStatus == Visit::QC_REFUSED) {
333
+		} else if ($visitObject->qcStatus == Visit::QC_REFUSED) {
334 334
 			return 6;
335
-		}else if ($visitObject->reviewStatus == Visit::NOT_DONE) {
335
+		} else if ($visitObject->reviewStatus == Visit::NOT_DONE) {
336 336
 			return 7;
337
-		}else if ($visitObject->reviewStatus == Visit::REVIEW_ONGOING) {
337
+		} else if ($visitObject->reviewStatus == Visit::REVIEW_ONGOING) {
338 338
 			return 8;
339
-		}else if ($visitObject->reviewStatus == Visit::REVIEW_WAIT_ADJUDICATION) {
339
+		} else if ($visitObject->reviewStatus == Visit::REVIEW_WAIT_ADJUDICATION) {
340 340
 			return 9;
341
-		}else if ($visitObject->reviewStatus == Visit::REVIEW_DONE) {
341
+		} else if ($visitObject->reviewStatus == Visit::REVIEW_DONE) {
342 342
 			return 10;
343
-		}else {
343
+		} else {
344 344
 			//If none of these case return -1, should not happen
345 345
 			return -1;
346 346
 		}
Please login to merge, or discard this patch.