@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $ageOfStudent = $diff_in_months; |
63 | 63 | $enrolmentMaximumAge = $admissionAge + 120; |
64 | 64 | return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge); |
65 | - }else { |
|
65 | + } else { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | } |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | } |
88 | 88 | return true; |
89 | 89 | } |
90 | - }else { |
|
90 | + } else { |
|
91 | 91 | $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name; |
92 | 92 | $this->_set_custom_stuff(); |
93 | 93 | return false; |
94 | 94 | } |
95 | - }else { |
|
95 | + } else { |
|
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
140 | 140 | $this->_set_custom_stuff(); |
141 | 141 | return false; |
142 | - }else{ |
|
142 | + } else{ |
|
143 | 143 | return true; |
144 | 144 | } |
145 | 145 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | if (($identityType !== null) && ($identityType !== "")) { |
166 | 166 | if (($identityType->national_code) === 'BC') { |
167 | 167 | return (strlen((string) $data['identity_number']) < 7); |
168 | - }else { |
|
168 | + } else { |
|
169 | 169 | return true; |
170 | 170 | } |
171 | - }else { |
|
171 | + } else { |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no; |
181 | 181 | $this->_set_custom_stuff(); |
182 | 182 | return false; |
183 | - }else { |
|
183 | + } else { |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | } |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | if ($identityType !== null) { |
191 | 191 | if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) { |
192 | 192 | return false; |
193 | - }else { |
|
193 | + } else { |
|
194 | 194 | return true; |
195 | 195 | } |
196 | - }else { |
|
196 | + } else { |
|
197 | 197 | return true; |
198 | 198 | } |
199 | 199 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | # # |
110 | 110 | ####################################################' ); |
111 | 111 | // $output->writeln(); |
112 | - }catch (\Exception $e){ |
|
112 | + } catch (\Exception $e){ |
|
113 | 113 | // echo $e->getMessage(); |
114 | 114 | $output->writeln( $e->getMessage()); |
115 | 115 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | $this->output->writeln('##########################################################################################################################'); |
113 | 113 | $this->output->writeln('updating from '. $shiftId); |
114 | 114 | |
115 | - }catch (\Exception $e){ |
|
115 | + } catch (\Exception $e){ |
|
116 | 116 | Log::error($e->getMessage(),[$e]); |
117 | 117 | } |
118 | 118 | } |
119 | 119 | // DB::commit(); |
120 | - }catch (\Exception $e){ |
|
120 | + } catch (\Exception $e){ |
|
121 | 121 | // DB::rollBack(); |
122 | 122 | Log::error($e->getMessage(),[$e]); |
123 | 123 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | unset($subjects['total_female_students']); |
138 | 138 | unset($subjects['id']); |
139 | 139 | $classSubject = Institution_subject::create($subjects); |
140 | - }catch (\Exception $e){ |
|
140 | + } catch (\Exception $e){ |
|
141 | 141 | Log::error($e->getMessage(),[$e]); |
142 | 142 | } |
143 | 143 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $params['class'] = $class; |
181 | 181 | $this->insertInstitutionClassSubjects($institutionSubjects,$class); |
182 | 182 | // array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params); |
183 | - }catch (\Exception $e){ |
|
183 | + } catch (\Exception $e){ |
|
184 | 184 | Log::error($e->getMessage(),[$e]); |
185 | 185 | } |
186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try{ |
191 | 191 | array_walk($subjects,array($this,'insertClassSubjects'),$class); |
192 | 192 | $this->output->writeln('updating subjects '. $class->name); |
193 | - }catch (\Exception $e){ |
|
193 | + } catch (\Exception $e){ |
|
194 | 194 | Log::error($e->getMessage(),[$e]); |
195 | 195 | } |
196 | 196 | }; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if(!$this->institution_class_subjects->isDuplicated($subjectobj)){ |
209 | 209 | $this->institution_class_subjects->create($subjectobj); |
210 | 210 | } |
211 | - }catch (\Exception $e){ |
|
211 | + } catch (\Exception $e){ |
|
212 | 212 | Log::error($e->getMessage(),[$e]); |
213 | 213 | } |
214 | 214 | } |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | unset($files); |
71 | 71 | exit(); |
72 | 72 | |
73 | - }else { |
|
73 | + } else { |
|
74 | 74 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
75 | 75 | $this->output->writeln('No files found,Waiting for files'); |
76 | 76 | exit(); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - }catch (Exception $e) { |
|
80 | + } catch (Exception $e) { |
|
81 | 81 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
82 | 82 | $this->output->writeln($e); |
83 | 83 | sleep(300); |
84 | 84 | $this->handle(); |
85 | 85 | |
86 | 86 | } |
87 | - }else { |
|
87 | + } else { |
|
88 | 88 | exit(); |
89 | 89 | } |
90 | 90 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | DB::table('uploads') |
162 | 162 | ->where('id', $file['id']) |
163 | 163 | ->update(['is_processed' => 1, 'is_email_sent' => 1, 'updated_at' => now()]); |
164 | - }catch (\Exception $ex) { |
|
164 | + } catch (\Exception $ex) { |
|
165 | 165 | $this->output->writeln($ex->getMessage()); |
166 | 166 | DB::table('uploads') |
167 | 167 | ->where('id', $file['id']) |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | DB::table('uploads') |
177 | 177 | ->where('id', $file['id']) |
178 | 178 | ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]); |
179 | - }catch (\Exception $ex) { |
|
179 | + } catch (\Exception $ex) { |
|
180 | 180 | $this->output->writeln($ex->getMessage()); |
181 | 181 | DB::table('uploads') |
182 | 182 | ->where('id', $file['id']) |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | DB::table('uploads') |
192 | 192 | ->where('id', $file['id']) |
193 | 193 | ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]); |
194 | - }catch (\Exception $ex) { |
|
194 | + } catch (\Exception $ex) { |
|
195 | 195 | $this->output->writeln($ex->getMessage()); |
196 | 196 | DB::table('uploads') |
197 | 197 | ->where('id', $file['id']) |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
206 | 206 | $this->output->writeln('Processing from:'.$node); |
207 | 207 | return true; |
208 | - }else { |
|
208 | + } else { |
|
209 | 209 | exit; |
210 | 210 | return false; |
211 | 211 | } |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | sleep(10); |
224 | 224 | $this->import($file, 2, 'B'); |
225 | 225 | |
226 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
226 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
227 | 227 | $this->output->writeln($e->getMessage()); |
228 | 228 | try { |
229 | 229 | Mail::to($user->email)->send(new IncorrectTemplate($file)); |
230 | 230 | DB::table('uploads') |
231 | 231 | ->where('id', $file['id']) |
232 | 232 | ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]); |
233 | - }catch (\Exception $ex) { |
|
233 | + } catch (\Exception $ex) { |
|
234 | 234 | $this->output->writeln($e->getMessage()); |
235 | 235 | $this->handle(); |
236 | 236 | DB::table('uploads') |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | ->update(['is_processed' => 2, 'is_email_sent' => 2, 'updated_at' => now()]); |
239 | 239 | } |
240 | 240 | } |
241 | - }else { |
|
241 | + } else { |
|
242 | 242 | exit(); |
243 | 243 | } |
244 | 244 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | break; |
361 | 361 | } |
362 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
362 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
363 | 363 | $this->output->writeln( $e->getMessage()); |
364 | 364 | if($sheet == 1){ |
365 | 365 | self::writeErrors($e,$file,'Insert Students'); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ->where('id', $file['id']) |
368 | 368 | ->update(['insert' => 2,'updated_at' => now()]); |
369 | 369 | $this->processFailedEmail($file,$user,'Fresh Student Data Upload:Failed'); |
370 | - }else if($sheet == 2){ |
|
370 | + } else if($sheet == 2){ |
|
371 | 371 | self::writeErrors($e,$file,'Update Students'); |
372 | 372 | DB::table('uploads') |
373 | 373 | ->where('id', $file['id']) |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | unset($failures); |
535 | 535 | } |
536 | 536 | |
537 | - }catch (Eception $e) { |
|
537 | + } catch (Eception $e) { |
|
538 | 538 | $this->output->writeln($e->getMessage()); |
539 | 539 | $user = User::find($file['security_user_id']); |
540 | 540 | DB::beginTransaction(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | if (!empty($isAvailableforPromotion)) { |
82 | 82 | $this->process($institutionGrade, $nextGrade, $year, 1); |
83 | - }else { |
|
83 | + } else { |
|
84 | 84 | $this->process($institutionGrade, $nextGrade, $year, 3); |
85 | 85 | } |
86 | 86 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | array_walk($studentListToPromote, array($this, 'assingeToClasses'), $params); |
128 | 128 | array_walk($parallelClasses, array($this, 'updateStudentCount')); |
129 | 129 | } |
130 | - }catch (\Exception $e) { |
|
130 | + } catch (\Exception $e) { |
|
131 | 131 | dd($e); |
132 | 132 | Log::error($e->getMessage()); |
133 | 133 | } |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | // promote parallel classes |
167 | 167 | $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, $nextGradeObj->toArray(), 1); |
168 | 168 | return 1; |
169 | - }elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
169 | + } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
170 | 170 | // promote pool promotion |
171 | 171 | $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 1); |
172 | 172 | return 2; |
173 | - }elseif (($nextGradeObj->count() > 1) && $currentGradeObj->count() == $nextGradeObj->count()) { |
|
173 | + } elseif (($nextGradeObj->count() > 1) && $currentGradeObj->count() == $nextGradeObj->count()) { |
|
174 | 174 | // Promote matching class name with previous class |
175 | 175 | $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, $nextGradeObj->toArray(), 1); |
176 | 176 | return 1; |
177 | - }else { |
|
177 | + } else { |
|
178 | 178 | // default pool promotion |
179 | 179 | $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 1); |
180 | 180 | return 2; |
181 | 181 | } |
182 | - }else { |
|
182 | + } else { |
|
183 | 183 | // default pool promotion |
184 | 184 | $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 3); |
185 | 185 | return 2; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $studentClass = $this->institution_class_students->getStudentNewClass($student); |
237 | 237 | if (!is_null($studentClass)) { |
238 | 238 | return array_search(str_replace($educationGrade['name'], $nextGrade->name, $studentClass->name), array_column($classes, 'name')); |
239 | - }else { |
|
239 | + } else { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->institution_class_students->create($studentObj); |
281 | 281 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
282 | 282 | $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
283 | - }else { |
|
283 | + } else { |
|
284 | 284 | $this->institution_class_students->where('id', (string) $student['id'])->update($studentObj); |
285 | 285 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
286 | 286 | $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | unset($files); |
51 | 51 | exit(); |
52 | 52 | |
53 | - }else { |
|
53 | + } else { |
|
54 | 54 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
55 | 55 | $output->writeln('No files found,Waiting for files'); |
56 | 56 | exit(); |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | - }catch (Exception $e) { |
|
60 | + } catch (Exception $e) { |
|
61 | 61 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
62 | 62 | $output->writeln($e); |
63 | 63 | sleep(300); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | DB::table('uploads') |
97 | 97 | ->where('id', $file['id']) |
98 | 98 | ->update(['is_processed' => 3, 'is_email_sent' => 1, 'updated_at' => now()]); |
99 | - }else { |
|
99 | + } else { |
|
100 | 100 | exit(); |
101 | 101 | } |
102 | 102 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $Initials = $Initials.''.mb_substr($names[$i], 0, 1, "UTF-8"); |
11 | 11 | } |
12 | 12 | $nameWithInitials = $Initials.' '.$names[$length - 1]; |
13 | - }else { |
|
13 | + } else { |
|
14 | 14 | $nameWithInitials = $fullname; |
15 | 15 | } |
16 | 16 | return $nameWithInitials; |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | function getMatchingKeys($array) { |
33 | 33 | $keys = []; |
34 | 34 | foreach ($array as $key => $value) { |
35 | - if (strstr($key, 'option')) |
|
36 | - $keys[] = $key; |
|
35 | + if (strstr($key, 'option')) { |
|
36 | + $keys[] = $key; |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | return $keys; |
39 | 40 | } |
@@ -82,7 +83,9 @@ discard block |
||
82 | 83 | function array_value_recursive($key, array $arr) { |
83 | 84 | $val = array(); |
84 | 85 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
85 | - if ($k == $key) array_push($val, $v); |
|
86 | + if ($k == $key) { |
|
87 | + array_push($val, $v); |
|
88 | + } |
|
86 | 89 | }); |
87 | 90 | return count($val) > 1 ? $val : array_pop($val); |
88 | 91 | } |
@@ -174,7 +177,9 @@ discard block |
||
174 | 177 | |
175 | 178 | function isEmptyRow($row) { |
176 | 179 | foreach ($row as $cell) { |
177 | - if (null !== $cell) return false; |
|
180 | + if (null !== $cell) { |
|
181 | + return false; |
|
182 | + } |
|
178 | 183 | } |
179 | 184 | return true; |
180 | 185 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | 'preferred' => 1 |
59 | 59 | ]; |
60 | 60 | self::updateOrCreate($data); |
61 | - }else { |
|
61 | + } else { |
|
62 | 62 | $exists = $exists->toArray(); |
63 | 63 | $exists['preferred'] = 1; |
64 | 64 | $exists['value'] = $data['contact']; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // $results = $gradeOptions; |
67 | 67 | // } |
68 | 68 | return $gradeOptions; |
69 | - }else { |
|
69 | + } else { |
|
70 | 70 | return null; |
71 | 71 | } |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
84 | 84 | } |
85 | - }else { |
|
85 | + } else { |
|
86 | 86 | $results = []; |
87 | 87 | } |
88 | 88 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if (!empty($nextProgrammeList)) { |
103 | 103 | $results = self::whereIn('education_programme_id', $nextProgrammeList) |
104 | 104 | ->get()->toArray(); |
105 | - }else { |
|
105 | + } else { |
|
106 | 106 | $results = []; |
107 | 107 | } |
108 | 108 |