Test Setup Failed
Pull Request — master (#654)
by Mohamed
06:54
created
app/Imports/Import.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         $highestColumn = $this->worksheet->getHighestDataColumn(3);
89 89
         $higestRow = 0;
90 90
         for ($row = $this->startRow(); $row <= $this->highestRow; $row++) {
91
-            $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
91
+            $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE);
92 92
             if (isEmptyRow(reset($rowData))) {
93 93
                 continue;
94
-            } else {
94
+            }else {
95 95
                 $higestRow += 1;
96 96
             }
97 97
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $this->failures = [];
106 106
         if (($column !== "") && (!in_array($column, $columns))) {
107 107
             $this->isValidSheet = false;
108
-            $this->error[] = 'Unsupported column found ,remove:' . $column;
108
+            $this->error[] = 'Unsupported column found ,remove:'.$column;
109 109
             $this->failure = new Failure(3, 'remark', $this->error, [null]);
110 110
             $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]);
111 111
         }
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $columns = Config::get('excel.columns');
120 120
         $optional_columns = Config::get('excel.optional_columns');
121
-        $columns = array_diff ($columns,$optional_columns);
121
+        $columns = array_diff($columns, $optional_columns);
122 122
         $error = \Illuminate\Validation\ValidationException::withMessages([]);
123 123
         $this->failures = [];
124 124
         foreach ($columns as  $column) {
125 125
                 if (($column !== "") && (!in_array($column, $existingColumns))) {
126 126
                     $this->isValidSheet = false;
127
-                    $this->error[] = 'Missing Column :' . $column . ' Not found';
127
+                    $this->error[] = 'Missing Column :'.$column.' Not found';
128 128
                     $this->failure = new Failure(3, 'remark', $this->error, [null]);
129 129
                     $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]);
130 130
                 }
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
         $highestColumn = $this->worksheet->getHighestDataColumn(3);
142 142
         $higestRow = 1;
143 143
         for ($row = $this->startRow(); $row <= $this->highestRow; $row++) {
144
-            $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
144
+            $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE);
145 145
             if (isEmptyRow(reset($rowData))) {
146 146
                 continue;
147
-            } else {
147
+            }else {
148 148
                 $higestRow += 1;
149 149
             }
150 150
         }
151 151
         if ($higestRow == 0) {
152 152
             exit;
153
-        } else {
153
+        }else {
154 154
             return $higestRow;
155 155
         }
156 156
     }
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
                     case 'string':
176 176
                         $row[$column] = preg_replace('/[^A-Za-z0-9\-]/', '-', $row[$column]);
177 177
                         $row[$column] = date($format, strtotime($row[$column])); //date($row[$column]);
178
-                        $row[$column] =  \Carbon\Carbon::createFromFormat($format, $row[$column]);
178
+                        $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]);
179 179
                         break;
180 180
                     case 'double';
181
-                        $row[$column] =  \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]);
181
+                        $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]);
182 182
                         break;
183 183
                 }
184 184
             }
185 185
             return $row;
186
-        } catch (Exception $e) {
186
+        }catch (Exception $e) {
187 187
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
188
-            $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $row[$column] . ' Not a valid date formate'], [null]);
188
+            $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$row[$column].' Not a valid date formate'], [null]);
189 189
             $failures = [0 => $failure];
190 190
             throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
191 191
         }
@@ -206,18 +206,18 @@  discard block
 block discarded – undo
206 206
         $row = $this->formateDate($row, 'mothers_date_of_birth_yyyy_mm_dd');
207 207
         $row = $this->formateDate($row, 'guardians_date_of_birth_yyyy_mm_dd');
208 208
 
209
-        $row['admission_no'] =  str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT);
209
+        $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT);
210 210
       
211 211
         if (array_key_exists('identity_type', $row)) {
212 212
         if ($row['identity_type'] == 'BC' && (!empty($row['birth_divisional_secretariat'])) && ($row['identity_number'] !== null) && $row['date_of_birth_yyyy_mm_dd'] !== null) {
213
-            $row['identity_number'] =  str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT);
213
+            $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT);
214 214
             // dd(($row['date_of_birth_yyyy_mm_dd']));
215
-            $BirthDivision = Area_administrative::where('name', 'like', '%' . $row['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5)->first();
215
+            $BirthDivision = Area_administrative::where('name', 'like', '%'.$row['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5)->first();
216 216
             if ($BirthDivision !== null) {
217
-                $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')
217
+                $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')
218 218
                     ->where('parent_id', '=', $BirthDivision->id)->first();
219 219
                 if ($BirthArea !== null) {
220
-                    $row['identity_number'] = $BirthArea->id . '' . $row['identity_number'] . '' . substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2) . '' . $row['date_of_birth_yyyy_mm_dd']->format("m");
220
+                    $row['identity_number'] = $BirthArea->id.''.$row['identity_number'].''.substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2).''.$row['date_of_birth_yyyy_mm_dd']->format("m");
221 221
                 }
222 222
             }
223 223
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
     {
231 231
         if (array_key_exists($key, $row)) {
232 232
             return true;
233
-        } else {
233
+        }else {
234 234
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
235
-            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $key, ' Is missing form the template'], [null]);
235
+            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$key, ' Is missing form the template'], [null]);
236 236
             $failures = [0 => $failure];
237 237
             new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
238 238
         };
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 
269 269
         if ($exceededStudents == true) {
270 270
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
271
-            $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is' . $institutionClass->no_of_students], [null]);
271
+            $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is'.$institutionClass->no_of_students], [null]);
272 272
             $failures = [0 => $failure];
273 273
             throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
274 274
             Log::info('email-sent', [$this->file]);
275
-        } else {
275
+        }else {
276 276
             return true;
277 277
         }
278 278
     }
Please login to merge, or discard this patch.
app/Models/Student_guardian.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Illuminate\Database\Eloquent\SoftDeletes;
8 8
 use Webpatser\Uuid\Uuid;
9 9
 
10
-class Student_guardian extends Base_Model  {
10
+class Student_guardian extends Base_Model {
11 11
 
12 12
     use SoftDeletes;
13 13
 
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
     public static function boot()
60 60
     {
61 61
         parent::boot();
62
-        self::creating(function ($model) {
62
+        self::creating(function($model) {
63 63
             $model->id = (string) Uuid::generate(4);
64 64
             $model->created_user_id = 1;
65 65
         });
66 66
     }
67 67
 
68
-    public static function createStudentGuardian($student,$guardian,$user){
68
+    public static function createStudentGuardian($student, $guardian, $user) {
69 69
      
70 70
         $exist = self::where('student_id', $student->student_id)
71 71
         ->where('guardian_relation_id', $guardian->guardian_relation_id)
72 72
         ->exists();
73 73
 
74
-        $totalGuardians = self::where('student_id',$student->student_id)->count();
74
+        $totalGuardians = self::where('student_id', $student->student_id)->count();
75 75
 
76 76
         $data = [
77 77
             'student_id' => $student->student_id,
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             'guardian_relation_id' => $guardian->guardian_relation_id,
80 80
             'created_user_id' => $user
81 81
         ];
82
-        if(!$exist){
82
+        if (!$exist) {
83 83
             $data['created'] = now();
84 84
             self::create($data);
85
-        }else{
85
+        }else {
86 86
             $data['modified'] = now();
87
-            self::where('student_id' , $student->student_id)
88
-            ->where('guardian_relation_id',$guardian->guardian_relation_id)
87
+            self::where('student_id', $student->student_id)
88
+            ->where('guardian_relation_id', $guardian->guardian_relation_id)
89 89
             ->update($data);
90 90
         }
91 91
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
         if(!$exist){
83 83
             $data['created'] = now();
84 84
             self::create($data);
85
-        }else{
85
+        } else{
86 86
             $data['modified'] = now();
87 87
             self::where('student_id' , $student->student_id)
88 88
             ->where('guardian_relation_id',$guardian->guardian_relation_id)
Please login to merge, or discard this patch.
app/Models/Institution_student.php 2 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -226,25 +226,25 @@
 block discarded – undo
226 226
         if(!is_null($father) && is_null($mother) && is_null($guardian)){
227 227
             Security_user::where('id',$student['student_id'])
228 228
             ->update(['address_area_id' => $father->address_area_id]);
229
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
229
+        } elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
230 230
             Security_user::where('id',$student['student_id'])
231 231
             ->update(['address_area_id' => $mother->address_area_id]);
232
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
232
+        } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
233 233
             Security_user::where('id',$student['student_id'])
234 234
             ->update(['address_area_id' => $guardian->address_area_id]);
235
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
235
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
236 236
             Security_user::where('id',$student['student_id'])
237 237
             ->update(['address_area_id' => $mother->address_area_id]);
238
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
238
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
239 239
             Security_user::where('id',$student['student_id'])
240 240
             ->update(['address_area_id' => $guardian->address_area_id]);
241
-        }elseif(!is_null($father) && $father->address == $student['address']){
241
+        } elseif(!is_null($father) && $father->address == $student['address']){
242 242
             Security_user::where('id',$student['student_id'])
243 243
             ->update(['address_area_id' => $guardian->address_area_id]);
244
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
244
+        } elseif(!is_null($mother) && $mother->address == $student['address']){
245 245
             Security_user::where('id',$student['student_id'])
246 246
             ->update(['address_area_id' => $mother->address_area_id]);
247
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
247
+        } elseif(!is_null($guardian) && $guardian->address == $student['address']){
248 248
             Security_user::where('id',$student['student_id'])
249 249
             ->update(['address_area_id' => $guardian->address_area_id]);
250 250
         }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function boot()
72 72
     {
73 73
         parent::boot();
74
-        self::creating(function ($model) {
74
+        self::creating(function($model) {
75 75
             $model->id = (string) Uuid::generate(4);
76 76
             $model->created = now();
77 77
         });
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
                 'institution_students.admission_id'
130 130
             )
131 131
             ->where('institution_students.institution_id', $institutionGrade['institution_id'])
132
-            ->where('institution_students.student_status_id',1)
132
+            ->where('institution_students.student_status_id', 1)
133 133
             ->where('institution_students.education_grade_id', $institutionGrade['education_grade_id'])
134
-            ->where('institution_students.deleted_at',null)
134
+            ->where('institution_students.deleted_at', null)
135 135
             ->where('institution_students.academic_period_id', $academicPeriod->id)->get()->toArray();
136 136
     }
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function createExaminationData($student, $admissionInfo)
146 146
     {
147
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
147
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
148 148
         try {
149 149
             self::create([
150 150
                 'id' => (string) Uuid::generate(4),
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 'created' => now(),
170 170
                 'created_user_id' => 1
171 171
             ]);
172
-        } catch (\Throwable $th) {
172
+        }catch (\Throwable $th) {
173 173
             Log::error($th);
174 174
         }
175 175
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public static function updateExaminationData($student, $admissionInfo)
185 185
     {
186
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
186
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
187 187
         try {
188 188
             self::where([
189 189
                 'student_id' => $student['student_id'],
@@ -204,50 +204,50 @@  discard block
 block discarded – undo
204 204
                     'modified_user_id' => 1
205 205
                 ]
206 206
             );
207
-        } catch (\Throwable $th) {
207
+        }catch (\Throwable $th) {
208 208
             Log::error($th);
209 209
         }
210 210
     }
211 211
 
212
-    public static function updateStudentArea(array $student){
213
-        $father = Student_guardian::where('student_id',$student['student_id'])
214
-        ->join('security_users as sg','guardian_id', 'sg.id')
215
-        ->where('guardian_relation_id',1)
212
+    public static function updateStudentArea(array $student) {
213
+        $father = Student_guardian::where('student_id', $student['student_id'])
214
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
215
+        ->where('guardian_relation_id', 1)
216 216
         ->get()->first();
217 217
 
218
-        $mother = Student_guardian::where('student_id',$student['student_id'])
219
-        ->join('security_users as sg','guardian_id', 'sg.id')
220
-        ->where('guardian_relation_id',2)
218
+        $mother = Student_guardian::where('student_id', $student['student_id'])
219
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
220
+        ->where('guardian_relation_id', 2)
221 221
         ->get()->first();
222 222
 
223
-        $guardian = Student_guardian::where('student_id',$student['student_id'])
224
-        ->join('security_users as sg','guardian_id', 'sg.id')
225
-        ->where('guardian_relation_id',3)
223
+        $guardian = Student_guardian::where('student_id', $student['student_id'])
224
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
225
+        ->where('guardian_relation_id', 3)
226 226
         ->get()->first();
227 227
 
228
-        if(!is_null($father) && is_null($mother) && is_null($guardian)){
229
-            Security_user::where('id',$student['student_id'])
228
+        if (!is_null($father) && is_null($mother) && is_null($guardian)) {
229
+            Security_user::where('id', $student['student_id'])
230 230
             ->update(['address_area_id' => $father->address_area_id]);
231
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
232
-            Security_user::where('id',$student['student_id'])
231
+        }elseif (!is_null($mother) && (is_null($father) && is_null($guardian))) {
232
+            Security_user::where('id', $student['student_id'])
233 233
             ->update(['address_area_id' => $mother->address_area_id]);
234
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
235
-            Security_user::where('id',$student['student_id'])
234
+        }elseif (!is_null($guardian) && is_null($father) && is_null($mother)) {
235
+            Security_user::where('id', $student['student_id'])
236 236
             ->update(['address_area_id' => $guardian->address_area_id]);
237
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
238
-            Security_user::where('id',$student['student_id'])
237
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)) {
238
+            Security_user::where('id', $student['student_id'])
239 239
             ->update(['address_area_id' => $mother->address_area_id]);
240
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
241
-            Security_user::where('id',$student['student_id'])
240
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)) {
241
+            Security_user::where('id', $student['student_id'])
242 242
             ->update(['address_area_id' => $guardian->address_area_id]);
243
-        }elseif(!is_null($father) && $father->address == $student['address']){
244
-            Security_user::where('id',$student['student_id'])
243
+        }elseif (!is_null($father) && $father->address == $student['address']) {
244
+            Security_user::where('id', $student['student_id'])
245 245
             ->update(['address_area_id' => $guardian->address_area_id]);
246
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
247
-            Security_user::where('id',$student['student_id'])
246
+        }elseif (!is_null($mother) && $mother->address == $student['address']) {
247
+            Security_user::where('id', $student['student_id'])
248 248
             ->update(['address_area_id' => $mother->address_area_id]);
249
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
250
-            Security_user::where('id',$student['student_id'])
249
+        }elseif (!is_null($guardian) && $guardian->address == $student['address']) {
250
+            Security_user::where('id', $student['student_id'])
251 251
             ->update(['address_area_id' => $guardian->address_area_id]);
252 252
         }
253 253
     }
Please login to merge, or discard this patch.
app/Console/Commands/RemoveDuplicatedGuardians.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,16 +52,16 @@
 block discarded – undo
52 52
     }
53 53
 
54 54
     public function delete(){
55
-       try{
56
-           DB::statement("UPDATE  student_guardians t1
55
+        try{
56
+            DB::statement("UPDATE  student_guardians t1
57 57
            INNER JOIN student_guardians t2 
58 58
                set t1.deleted_at=now() 
59 59
            WHERE 
60 60
                t1.id > t2.id AND
61 61
                t1.student_id = t2.student_id AND
62 62
                t1.guardian_id = t2.guardian_id");
63
-       }catch(\Exception $e){
64
-           dd($e);
65
-       }
63
+        }catch(\Exception $e){
64
+            dd($e);
65
+        }
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
             $this->output->writeln('############### Starting delete Duplication ################');
46 46
             Student_guardian::withTrashed()->restore();
47 47
             $this->delete();
48
-            $this->end_time  = microtime(TRUE);
49
-            $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
50
-        } catch (\Throwable $th) {
48
+            $this->end_time = microtime(TRUE);
49
+            $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
50
+        }catch (\Throwable $th) {
51 51
         }
52 52
     }
53 53
 
54
-    public function delete(){
55
-       try{
54
+    public function delete() {
55
+       try {
56 56
            DB::statement("UPDATE  student_guardians t1
57 57
            INNER JOIN student_guardians t2 
58 58
                set t1.deleted_at=now() 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                t1.id > t2.id AND
61 61
                t1.student_id = t2.student_id AND
62 62
                t1.guardian_id = t2.guardian_id");
63
-       }catch(\Exception $e){
63
+       }catch (\Exception $e) {
64 64
            dd($e);
65 65
        }
66 66
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
                t1.id > t2.id AND
61 61
                t1.student_id = t2.student_id AND
62 62
                t1.guardian_id = t2.guardian_id");
63
-       }catch(\Exception $e){
63
+       } catch(\Exception $e){
64 64
            dd($e);
65 65
        }
66 66
     }
Please login to merge, or discard this patch.
app/Console/Commands/CloneConfigData.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         if(count($shift) > 0){
67 67
             // processParallel($function,$shift, $this->argument('max'),$params);
68 68
             array_walk($shift,$function,$params);
69
-        }else{
69
+        } else{
70 70
             $this->output->writeln('Nothing to clone');
71 71
         }
72 72
         $this->end_time = microtime(TRUE);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
55 55
         $mode = $this->argument('mode') == 'AL' ? true : false; 
56 56
         $previousAcademicPeriodYear = $academicPeriod->order;
57
-        $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first();
58
-        $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code,$this->argument(('max')),$mode);
57
+        $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first();
58
+        $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code, $this->argument(('max')), $mode);
59 59
         $params = [
60 60
             'year' => $year,
61 61
             'academic_period' => $academicPeriod,
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
         ];
65 65
 
66 66
         $function = array($this->clone, 'process');
67
-        if(count($shift) > 0){
67
+        if (count($shift) > 0) {
68 68
             // processParallel($function,$shift, $this->argument('max'),$params);
69
-            array_walk($shift,$function,$params);
70
-        }else{
69
+            array_walk($shift, $function, $params);
70
+        }else {
71 71
             $this->output->writeln('Nothing to clone');
72 72
         }
73 73
         $this->end_time = microtime(TRUE);
74 74
 
75 75
 
76 76
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
77
-        $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
77
+        $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
78 78
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
79 79
     }  
80 80
 }
Please login to merge, or discard this patch.
app/Console/Commands/MapStudentArea.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct()
32 32
     {
33
-        $this->output =  new \Symfony\Component\Console\Output\ConsoleOutput();
33
+        $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
34 34
         parent::__construct();
35 35
     }
36 36
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function handle()
43 43
     {
44
-        $students = Security_user::where('is_student',true)->get()->toArray();
45
-        array_walk($students,array($this,'process'));
44
+        $students = Security_user::where('is_student', true)->get()->toArray();
45
+        array_walk($students, array($this, 'process'));
46 46
     }
47 47
 
48
-    public function process($student){
48
+    public function process($student) {
49 49
         $student['student_id'] = $student['id'];
50 50
         Institution_student::updateStudentArea($student);
51
-        $this->output->writeln('area updated for student:'. $student['openemis_no']) ;
51
+        $this->output->writeln('area updated for student:'.$student['openemis_no']);
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
app/Console/Commands/cleanConfig.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,16 +48,16 @@
 block discarded – undo
48 48
         $year = $this->argument('year');
49 49
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
50 50
         $previousAcademicPeriodYear = $academicPeriod->order;
51
-        $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first();
51
+        $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first();
52 52
 
53 53
         $params = [
54 54
             'academic_period' => $academicPeriod,
55 55
             'previous_academic_period' => $previousAcademicPeriod
56 56
         ];
57 57
 
58
-        if($year == '2019' || $year == '2018/19'){
58
+        if ($year == '2019' || $year == '2018/19') {
59 59
             die('Academic Year 2019 or earlier can`t be deleted');
60
-        }else{
60
+        }else {
61 61
             $this->clone->cleanConfig($params);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
         if($year == '2019' || $year == '2018/19'){
59 59
             die('Academic Year 2019 or earlier can`t be deleted');
60
-        }else{
60
+        } else{
61 61
             $this->clone->cleanConfig($params);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.
app/Http/Controllers/CloneController.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function array_walk($shift, $count, $params)
42 42
     {
43 43
         try{
44
-           DB::beginTransaction();
44
+            DB::beginTransaction();
45 45
             array_walk($shift, array($this, 'process'), $params);
46 46
             DB::commit();
47 47
         }catch(\Exception $e){
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
            DB::beginTransaction();
45 45
             array_walk($shift, array($this, 'process'), $params);
46 46
             DB::commit();
47
-        }catch(\Exception $e){
47
+        } catch(\Exception $e){
48 48
             $this->output->writeln('Terminating ' . $shift['institution_id']);
49 49
             DB::rollBack();
50 50
         }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
         $this->academic_period = new Academic_period();
32 32
         $this->institution_classes = new Institution_class();
33 33
         $this->institution_class_subjects = new Institution_class_subject();
34
-        $this->institution_subjects =  new Institution_subject();
34
+        $this->institution_subjects = new Institution_subject();
35 35
         $this->institution_grades = new Institution_grade();
36
-        $this->education_grade_subjects =  new Education_grades_subject();
36
+        $this->education_grade_subjects = new Education_grades_subject();
37 37
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
38 38
     }
39 39
 
40 40
 
41 41
     public function array_walk($shift, $count, $params)
42 42
     {
43
-        try{
43
+        try {
44 44
            DB::beginTransaction();
45 45
             array_walk($shift, array($this, 'process'), $params);
46 46
             DB::commit();
47
-        }catch(\Exception $e){
48
-            $this->output->writeln('Terminating ' . $shift['institution_id']);
47
+        }catch (\Exception $e) {
48
+            $this->output->writeln('Terminating '.$shift['institution_id']);
49 49
             DB::rollBack();
50 50
         }
51 51
     }
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
         $this->shifts->where(['cloned' => $academicPeriod->code])->update(['cloned' => $params['previous_academic_period']['code']]);
60 60
         $this->output->writeln('updated shifts');
61 61
 
62
-        $classIds =  $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray();
62
+        $classIds = $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray();
63 63
         $this->institution_classes->where(['academic_period_id' => $academicPeriod->id])->delete();
64 64
         $this->output->writeln('cleaned classes');
65 65
 
66 66
         do {
67 67
             $deleted = $this->institution_class_subjects->whereRaw("institution_class_id not in (select id from institution_classes where academic_period_id =".$academicPeriod->id." )")->limit(10000)->delete();
68 68
             $this->output->writeln('cleaned subjects');
69
-        }while($deleted > 0);
69
+        } while ($deleted > 0);
70 70
 
71 71
         do {
72
-            $deleted =  $this->institution_subjects->where('academic_period_id', $academicPeriod->id)->limit(10000)->delete();
72
+            $deleted = $this->institution_subjects->where('academic_period_id', $academicPeriod->id)->limit(10000)->delete();
73 73
             $this->output->writeln('10000 institutions cleaned subjects');
74 74
         } while ($deleted > 0);
75 75
     }
76 76
 
77 77
     public function process($shift, $count, $params)
78 78
     {
79
-        echo ('[' . getmypid() . ']This Process executed at' . date("F d, Y h:i:s A") . "\n");
79
+        echo ('['.getmypid().']This Process executed at'.date("F d, Y h:i:s A")."\n");
80 80
         $year = $params['year'];
81 81
         $academicPeriod = $params['academic_period'];
82 82
         $previousAcademicPeriod = $params['previous_academic_period'];
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 
95 95
 
96 96
         if ($mode) {
97
-            $institutionClasses = $this->institution_classes->getShiftClasses($shift,  $mode, $params);
97
+            $institutionClasses = $this->institution_classes->getShiftClasses($shift, $mode, $params);
98 98
             try {
99 99
                 array_walk($institutionClasses, array($this, 'updateInstitutionClasses'), $params);
100
-                $this->output->writeln('updating from ' . $shift['institution_id']);
101
-            } catch (\Exception $e) {
100
+                $this->output->writeln('updating from '.$shift['institution_id']);
101
+            }catch (\Exception $e) {
102 102
                 Log::error($e->getMessage(), [$e]);
103 103
             }
104
-        } else {
104
+        }else {
105 105
             $institutionSubjects = $this->institution_grades->getGradeSubjects($shift['institution_id']);
106 106
             try {
107 107
                 if ($data['created']) {
@@ -112,32 +112,32 @@  discard block
 block discarded – undo
112 112
                         try {
113 113
                             array_walk($newInstitutionClasses, array($this, 'insertInstitutionClasses'), $params);
114 114
                             $this->output->writeln('##########################################################################################################################');
115
-                            $this->output->writeln('updating from = ' . $shift['institution_id']);
116
-                        } catch (\Exception $e) {
117
-                            $this->output->writeln('Terminating ' . $shift['institution_id']);
115
+                            $this->output->writeln('updating from = '.$shift['institution_id']);
116
+                        }catch (\Exception $e) {
117
+                            $this->output->writeln('Terminating '.$shift['institution_id']);
118 118
                             DB::rollBack();
119 119
                             Log::error($e->getMessage(), [$e]);
120 120
                         }
121
-                    } else {
122
-                        $this->output->writeln('no classes found ' . $shift['institution_id']);
121
+                    }else {
122
+                        $this->output->writeln('no classes found '.$shift['institution_id']);
123 123
                     }
124
-                } else {
124
+                }else {
125 125
                     try {
126 126
                         $shift['id'] = $shiftId;
127 127
                         $institutionClasses = $this->institution_classes->getShiftClasses($shift, $mode);
128 128
                         array_walk($institutionClasses, array($this, 'updateInstitutionClasses'), $params);
129 129
                         $this->output->writeln('##########################################################################################################################');
130
-                        $this->output->writeln('updating from ' . $shift['institution_id']);
131
-                    } catch (\Exception $e) {
132
-                        $this->output->writeln('Terminating ' . $shift['institution_id']);
130
+                        $this->output->writeln('updating from '.$shift['institution_id']);
131
+                    }catch (\Exception $e) {
132
+                        $this->output->writeln('Terminating '.$shift['institution_id']);
133 133
                         DB::rollBack();
134 134
                         Log::error($e->getMessage(), [$e]);
135 135
                     }
136 136
                 }
137 137
                 DB::commit();
138
-            } catch (\Exception $e) {
138
+            }catch (\Exception $e) {
139 139
                 Log::error($e->getMessage(), [$e]);
140
-                $this->output->writeln('Terminating ' . $shift['institution_id']);
140
+                $this->output->writeln('Terminating '.$shift['institution_id']);
141 141
                 DB::rollBack();
142 142
             }
143 143
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $subject['created'] = now();
157 157
             $subject['created_user_id'] = 1;
158 158
             $this->institution_subjects->create($subject);
159
-        } catch (\Exception $e) {
159
+        }catch (\Exception $e) {
160 160
             DB::rollBack();
161 161
             Log::error($e->getMessage(), [$e]);
162 162
         }
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
         try {
168 168
             if ($params['mode']) {
169 169
                 Institution_class::where('id', $class['id'])
170
-                    ->where('academic_period_id',$params['previous_academic_period_id'])
170
+                    ->where('academic_period_id', $params['previous_academic_period_id'])
171 171
                     ->update([
172 172
                         'institution_shift_id' => $params['shift_id'],
173 173
                         'academic_period_id' => $params['academic_period_id']
174 174
                     ]);
175 175
 
176 176
                 Institution_class_student::where('institution_class_id', $class['id'])
177
-                    ->where('academic_period_id',$params['previous_academic_period_id'])    
177
+                    ->where('academic_period_id', $params['previous_academic_period_id'])    
178 178
                     ->update([
179 179
                         'academic_period_id' => $params['academic_period_id'],
180 180
                         'modified' => now()
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
                 $educationGrade = Institution_class_grade::select('education_grade_id')->where('institution_class_id', $class['id'])->get()->toArray();
184 184
 
185 185
                 Institution_student::whereIn('education_grade_id', $educationGrade)
186
-                    ->where('academic_period_id',$params['previous_academic_period_id'])
186
+                    ->where('academic_period_id', $params['previous_academic_period_id'])
187 187
                     ->update([
188 188
                         'academic_period_id' => $params['academic_period_id']
189 189
                     ]);
190 190
             }
191
-        } catch (\Exception $e) {
191
+        }catch (\Exception $e) {
192 192
             DB::rollBack();
193 193
             Log::error($e->getMessage(), [$e]);
194 194
         }
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
             $class['created'] = now();
219 219
             $class['institution_shift_id'] = $param['shift_id'];
220 220
             // $class['created_user_id'] = 
221
-            $this->output->writeln('Create class:' . $class['name']);
222
-            $class =  Institution_class::create($class);
221
+            $this->output->writeln('Create class:'.$class['name']);
222
+            $class = Institution_class::create($class);
223 223
             $institutionClassGrdaeObj['institution_class_id'] = $class->id;
224 224
             $institutionClassGrdaeObj['education_grade_id'] = $educationGrdae;
225 225
             $institutionClassGrdaeObj['created_user_id'] = $class['created_user_id'];
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                 ->toArray();
232 232
             $params['class'] = $class;
233 233
             $this->insertInstitutionClassSubjects($institutionSubjects, $class);
234
-        } catch (\Exception $e) {
234
+        }catch (\Exception $e) {
235 235
             DB::rollBack();
236 236
             Log::error($e->getMessage(), [$e]);
237 237
         }
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
         if (!empty($subjects)) {
243 243
             try {
244 244
                 array_walk($subjects, array($this, 'insertClassSubjects'), $class);
245
-                $this->output->writeln('updating subjects ' . $class->name);
246
-            } catch (\Exception $e) {
245
+                $this->output->writeln('updating subjects '.$class->name);
246
+            }catch (\Exception $e) {
247 247
                 DB::rollBack();
248 248
                 Log::error($e->getMessage(), [$e]);
249 249
             }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             if (!$this->institution_class_subjects->isDuplicated($subjectobj)) {
265 265
                 $this->institution_class_subjects->create($subjectobj);
266 266
             }
267
-        } catch (\Exception $e) {
267
+        }catch (\Exception $e) {
268 268
             DB::rollBack();
269 269
             Log::error($e->getMessage(), [$e]);
270 270
         }
@@ -312,19 +312,19 @@  discard block
 block discarded – undo
312 312
                 unset($shift['id']);
313 313
                 unset($shift['created']);
314 314
                 unset($shift['modified']);
315
-                $shift = $this->shifts->create((array)$shift);
315
+                $shift = $this->shifts->create((array) $shift);
316 316
                 $data = [
317 317
                     'shift_id' => $shift->id,
318 318
                     'created' => true
319 319
                 ];
320
-            } else {
320
+            }else {
321 321
                 $data = [
322 322
                     'shift_id' => $exist->id,
323 323
                     'created' => false
324 324
                 ];
325 325
             };
326 326
             return $data;
327
-        } catch (\Exception $e) {
327
+        }catch (\Exception $e) {
328 328
             DB::rollBack();
329 329
         }
330 330
     }
Please login to merge, or discard this patch.
app/Console/Commands/CallPromotionCommand.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,21 +48,21 @@
 block discarded – undo
48 48
         $mode = $this->argument('mode');
49 49
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
50 50
         $previousAcademicPeriodYear = $academicPeriod->order;
51
-        $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first();
52
-        $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code,$limit,$mode);
51
+        $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first();
52
+        $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code, $limit, $mode);
53 53
         $params = [
54 54
             'year' => $year,
55 55
             'mode'=> $mode
56 56
         ];
57
-        if(in_array($mode,['AL','1-5','SP','6-11'])){
58
-            array_walk($institutions,array($this,'callPromotion'),$params);
59
-        }else{
57
+        if (in_array($mode, ['AL', '1-5', 'SP', '6-11'])) {
58
+            array_walk($institutions, array($this, 'callPromotion'), $params);
59
+        }else {
60 60
             die('The give mode not support');
61 61
         }
62 62
        
63 63
     }
64 64
 
65
-    protected function callPromotion($institution,$count,$params){
66
-        $this->call('promote:students',['year' => $params['year'],'institution' => $institution['code'],'mode' => $params['mode'] ]);
65
+    protected function callPromotion($institution, $count, $params) {
66
+        $this->call('promote:students', ['year' => $params['year'], 'institution' => $institution['code'], 'mode' => $params['mode']]);
67 67
     }
68 68
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         ];
57 57
         if(in_array($mode,['AL','1-5','SP','6-11'])){
58 58
             array_walk($institutions,array($this,'callPromotion'),$params);
59
-        }else{
59
+        } else{
60 60
             die('The give mode not support');
61 61
         }
62 62
        
Please login to merge, or discard this patch.