GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( a9b779...4ac84e )
by Tracy
06:32
created
project-css/database/migrations/2016_12_06_234158_create_tables_table.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
             // Table cascade if the collections are deleted
24 24
             $table->foreign('collection_id')
25
-                  ->references('id')
26
-                  ->on('collections')
27
-                  ->onDelete('cascade');
25
+                    ->references('id')
26
+                    ->on('collections')
27
+                    ->onDelete('cascade');
28 28
         });
29 29
     }
30 30
 
Please login to merge, or discard this patch.
src/project-css/tests/AuthTest.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -46,39 +46,39 @@
 block discarded – undo
46 46
 
47 47
         // Type some valid values
48 48
         $this->visit('/login')
49
-             ->type($this->adminEmail, 'email')
50
-             ->type($this->adminPass, 'password')
51
-             ->press('Login');
49
+                ->type($this->adminEmail, 'email')
50
+                ->type($this->adminPass, 'password')
51
+                ->press('Login');
52 52
 
53 53
         // Type some valid values
54 54
         $this->visit('/register')
55
-             ->type($this->userName, 'name')
56
-             ->type($this->userEmail, 'email')
57
-             ->type($this->userPass, 'password')
58
-             ->type($this->userPass, 'password_confirmation')
59
-             ->press('Register')
60
-             ->seePageIs('/users');
55
+                ->type($this->userName, 'name')
56
+                ->type($this->userEmail, 'email')
57
+                ->type($this->userPass, 'password')
58
+                ->type($this->userPass, 'password_confirmation')
59
+                ->press('Register')
60
+                ->seePageIs('/users');
61 61
     }
62 62
 
63 63
     /** @test */
64 64
     public function testWrongLoginCredentials() {
65 65
         $this->visit(route('login'))
66
-             ->type($this->userEmail, 'email')
67
-             ->type('invalid-password', 'password')
68
-             ->press('Login')
69
-             ->see('These credentials do not match our records.');
66
+                ->type($this->userEmail, 'email')
67
+                ->type('invalid-password', 'password')
68
+                ->press('Login')
69
+                ->see('These credentials do not match our records.');
70 70
     }
71 71
 
72 72
     /** @test */
73 73
     public function testForgotPasswordWithIncorrectEmail() {
74 74
         $this->visit('/password/reset')
75
-             ->see('Reset Password')
76
-             ->type('test', 'email')
77
-             ->press('Send Password Reset Link')
78
-             ->see('The email must be a valid email address.')
79
-             ->type('[email protected]', 'email')
80
-             ->press('Send Password Reset Link')
81
-             ->see("We can't find a user with that e-mail address.");
75
+                ->see('Reset Password')
76
+                ->type('test', 'email')
77
+                ->press('Send Password Reset Link')
78
+                ->see('The email must be a valid email address.')
79
+                ->type('[email protected]', 'email')
80
+                ->press('Send Password Reset Link')
81
+                ->see("We can't find a user with that e-mail address.");
82 82
     }
83 83
 
84 84
     /** @test */
Please login to merge, or discard this patch.
src/project-css/app/Libraries/TikaConvert.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
 
22 22
     function setTikaPort($port) {
23
-      $this->tika_port = $port;
23
+        $this->tika_port = $port;
24 24
     }
25 25
 
26 26
     /**
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
     {
34 34
         // verify that file exists
35 35
         if (!$filename || !file_exists($filename)) {
36
-          return false;
36
+            return false;
37 37
         }
38 38
 
39 39
         // verify that tika server is accepting connections
40 40
         if (!$this->serverOpen()) {
41
-          return false;
41
+            return false;
42 42
         }
43 43
 
44 44
         // this is one way to use the tika server using the exec command creates a temporary file
Please login to merge, or discard this patch.
src/project-css/app/Http/Controllers/TableController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -726,8 +726,7 @@
 block discarded – undo
726 726
           $prcssd += 1;
727 727
           $curFltFleObj->next();
728 728
         }
729
-      }
730
-      else {
729
+      } else {
731 730
         throw new \Exception("Cannot Import a Empty File.");
732 731
       }
733 732
     }
Please login to merge, or discard this patch.
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -28,77 +28,77 @@  discard block
 block discarded – undo
28 28
      * Create a new controller instance.
29 29
      */
30 30
     public function __construct($storageFolder = 'flatfiles') {
31
-      // Protection to make sure this is only accessible to admin
32
-      $this->middleware('admin');
33
-      // Storage directory
34
-      $this->strDir = $storageFolder;
35
-      // offset for extra colmns
36
-      $this->extraClmns = 3;
31
+        // Protection to make sure this is only accessible to admin
32
+        $this->middleware('admin');
33
+        // Storage directory
34
+        $this->strDir = $storageFolder;
35
+        // offset for extra colmns
36
+        $this->extraClmns = 3;
37 37
     }
38 38
 
39 39
     /**
40
-    * Show the table index page
41
-    */
40
+     * Show the table index page
41
+     */
42 42
     public function index() {
43
-      // Get all the table records
44
-      $tbls = Table::all();
45
-      // return the index page
46
-      return view('admin/table')->with('tbls', $tbls);
43
+        // Get all the table records
44
+        $tbls = Table::all();
45
+        // return the index page
46
+        return view('admin/table')->with('tbls', $tbls);
47 47
     }
48 48
 
49 49
     /**
50
-    * Show the wizard page
51
-    */
50
+     * Show the wizard page
51
+     */
52 52
     public function wizard() {
53
-      // Get the collection names
54
-      $collcntNms = Collection::all();
53
+        // Get the collection names
54
+        $collcntNms = Collection::all();
55 55
 
56
-      // Get the list of files in the directory
57
-      $fltFleList = Storage::allFiles($this->strDir);
56
+        // Get the list of files in the directory
57
+        $fltFleList = Storage::allFiles($this->strDir);
58 58
 
59
-      // Format the file names by truncating the dir
60
-      foreach ($fltFleList as $key => $value) {
59
+        // Format the file names by truncating the dir
60
+        foreach ($fltFleList as $key => $value) {
61 61
         // check if directory string exists in the path
62 62
         if (str_contains($value, $this->strDir.'/')) {
63
-          // replace the string
64
-          $fltFleList[ $key ] = str_replace($this->strDir.'/', '', $value);
63
+            // replace the string
64
+            $fltFleList[ $key ] = str_replace($this->strDir.'/', '', $value);
65
+        }
65 66
         }
66
-      }
67 67
 
68
-      // Compact everything into array
69
-      $wizrdData = array(
68
+        // Compact everything into array
69
+        $wizrdData = array(
70 70
         'collcntNms' => $collcntNms,
71 71
         'fltFleList' => $fltFleList
72
-      );
72
+        );
73 73
 
74
-      // Check for the countflatfiles
75
-      if ($collcntNms->where('isEnabled', '1')->count()>0) {
74
+        // Check for the countflatfiles
75
+        if ($collcntNms->where('isEnabled', '1')->count()>0) {
76 76
         // return the wizard page by passing the collections
77 77
         return view('admin/wizard')->with($wizrdData);
78
-      }
78
+        }
79 79
 
80
-      // return the wizard page by passing the collections and list of files
81
-      return view('admin/collection')->with('collcntNms', $collcntNms)->withErrors([ 'Please create active collection here first' ]);
80
+        // return the wizard page by passing the collections and list of files
81
+        return view('admin/collection')->with('collcntNms', $collcntNms)->withErrors([ 'Please create active collection here first' ]);
82 82
     }
83 83
 
84 84
     /**
85
-    * Importing the records into table follows:
86
-    * 1. Input the table name in the meta Directory
87
-    * 2. Store the file on to Storage Directory if uploaded
88
-    * 3. Show the users schema for further verification
89
-    */
85
+     * Importing the records into table follows:
86
+     * 1. Input the table name in the meta Directory
87
+     * 2. Store the file on to Storage Directory if uploaded
88
+     * 3. Show the users schema for further verification
89
+     */
90 90
     public function import(Request $request) {
91 91
 
92
-      // 1. Input the table name in the meta Directory
93
-      //Rules for validation
94
-      $rules = array(
92
+        // 1. Input the table name in the meta Directory
93
+        //Rules for validation
94
+        $rules = array(
95 95
         'imprtTblNme' => 'required|unique:tables,tblNme|max:30|min:6|alpha_num',
96 96
         'colID' => 'required|Integer',
97 97
         'fltFile' => 'required|file|mimetypes:text/plain|mimes:txt,dat,csv,tab',
98
-      );
98
+        );
99 99
 
100
-      //Customize the error messages
101
-      $messages = array(
100
+        //Customize the error messages
101
+        $messages = array(
102 102
         'imprtTblNme.required' => 'Please enter a table name',
103 103
         'imprtTblNme.unique' => 'The table name has already been taken by current or disabled table',
104 104
         'imprtTblNme.max' => 'The table name cannot exceed 30 characters',
@@ -110,70 +110,70 @@  discard block
 block discarded – undo
110 110
         'fltFile.file' => 'Please select a valid flat file',
111 111
         'fltFile.mimetypes' => 'The flat file must be a file of type: text/plain.',
112 112
         'fltFile.mimes' => 'The flat file must have an extension: txt, dat, csv, tab.',
113
-      );
113
+        );
114 114
 
115
-      // Validate the request before storing the data
116
-      $this->validate($request, $rules, $messages);
115
+        // Validate the request before storing the data
116
+        $this->validate($request, $rules, $messages);
117 117
 
118
-      // Validate the file before upload
119
-      // Get the file
120
-      $thisFltFile = $request->fltFile;
118
+        // Validate the file before upload
119
+        // Get the file
120
+        $thisFltFile = $request->fltFile;
121 121
 
122
-      // Get the file name
123
-      $thisFltFileNme = $thisFltFile->getClientOriginalName();
122
+        // Get the file name
123
+        $thisFltFileNme = $thisFltFile->getClientOriginalName();
124 124
 
125
-      // check if the file exists
126
-      // Get the list of files in the directory
127
-      $fltFleList = Storage::allFiles($this->strDir);
125
+        // check if the file exists
126
+        // Get the list of files in the directory
127
+        $fltFleList = Storage::allFiles($this->strDir);
128 128
 
129
-      // check the file name in the file list array
130
-      if (in_array($this->strDir.'/'.$thisFltFileNme, $fltFleList)) {
129
+        // check the file name in the file list array
130
+        if (in_array($this->strDir.'/'.$thisFltFileNme, $fltFleList)) {
131 131
         return redirect()->route('tableIndex')->withErrors([ 'File already exists. Please select the file or rename and re-upload.' ]);
132
-      }
132
+        }
133 133
 
134
-      // 2. Store the file on to Storage Directory if uploaded
135
-      // Store in the directory inside storage/app
136
-      $thisFltFile->storeAs($this->strDir, $thisFltFileNme);
134
+        // 2. Store the file on to Storage Directory if uploaded
135
+        // Store in the directory inside storage/app
136
+        $thisFltFile->storeAs($this->strDir, $thisFltFileNme);
137 137
 
138
-      // 3. Show the users schema for further verification
139
-      $schema = (new CSVHelper)->schema($this->strDir.'/'.$thisFltFileNme);
138
+        // 3. Show the users schema for further verification
139
+        $schema = (new CSVHelper)->schema($this->strDir.'/'.$thisFltFileNme);
140 140
 
141
-      // If the file isn't valid return with an error
142
-      if (!$schema) {
141
+        // If the file isn't valid return with an error
142
+        if (!$schema) {
143 143
         Storage::delete($fltFleAbsPth);
144 144
         return redirect()->route('tableIndex')->withErrors([ 'The selected flat file must be of type: text/plain', 'The selected flat file should not be empty', 'File is deleted for security reasons' ]);
145
-      }
145
+        }
146 146
 
147
-      // Return the view with filename and schema
148
-      return view('admin.schema')->with('schema', $schema)
149
-                                 ->with('tblNme', $request->imprtTblNme)
150
-                                 ->with('fltFile', $thisFltFileNme)
151
-                                 ->with('collctnId', $request->colID);
147
+        // Return the view with filename and schema
148
+        return view('admin.schema')->with('schema', $schema)
149
+                                    ->with('tblNme', $request->imprtTblNme)
150
+                                    ->with('fltFile', $thisFltFileNme)
151
+                                    ->with('collctnId', $request->colID);
152 152
     }
153 153
 
154 154
     public function importCMSDIS(Request $request) {
155
-      return (new TableHelper)->storeUploadsAndImport($this->strDir, $request->colID, $request->cmsdisFiles);
155
+        return (new TableHelper)->storeUploadsAndImport($this->strDir, $request->colID, $request->cmsdisFiles);
156 156
     }
157 157
 
158 158
     /**
159
-    * Use the existing file to import the records:
160
-    * Algorithm:
161
-    * 1. Get the file name and validate file, if not validated remove it
162
-    * 2. Create the table with schema
163
-    * 3. Show the users with the schema
164
-    */
159
+     * Use the existing file to import the records:
160
+     * Algorithm:
161
+     * 1. Get the file name and validate file, if not validated remove it
162
+     * 2. Create the table with schema
163
+     * 3. Show the users with the schema
164
+     */
165 165
     public function select(Request $request) {
166 166
 
167
-      // 1. Get the file name and validate file, if not validated remove it
168
-      //Rules for validation
169
-      $rules = array(
167
+        // 1. Get the file name and validate file, if not validated remove it
168
+        //Rules for validation
169
+        $rules = array(
170 170
         'slctTblNme' => 'required|unique:tables,tblNme|max:30|min:6|alpha_num',
171 171
         'colID2' => 'required|Integer',
172 172
         'fltFile2' => 'required|string',
173
-      );
173
+        );
174 174
 
175
-      //Customize the error messages
176
-      $messages = array(
175
+        //Customize the error messages
176
+        $messages = array(
177 177
         'slctTblNme.required' => 'Please enter a table name',
178 178
         'slctTblNme.unique' => 'The table name has already been taken by current or disabled table',
179 179
         'slctTblNme.max' => 'The table name cannot exceed 30 characters',
@@ -183,54 +183,54 @@  discard block
 block discarded – undo
183 183
         'colID2.Integer' => 'Please select an existing collection',
184 184
         'fltFile2.required' => 'Please select a valid flat file',
185 185
         'fltFile2.string' => 'Please select a valid flat file',
186
-      );
186
+        );
187 187
 
188
-      // Validate the request before storing the data
189
-      $this->validate($request, $rules, $messages);
188
+        // Validate the request before storing the data
189
+        $this->validate($request, $rules, $messages);
190 190
 
191
-      // Get the absolute file path
192
-      $thsFltFile = $request->fltFile2;
193
-      $fltFleAbsPth = $this->strDir.'/'.$thsFltFile;
194
-      // validate the file
195
-      if (!Storage::has($fltFleAbsPth)) {
191
+        // Get the absolute file path
192
+        $thsFltFile = $request->fltFile2;
193
+        $fltFleAbsPth = $this->strDir.'/'.$thsFltFile;
194
+        // validate the file
195
+        if (!Storage::has($fltFleAbsPth)) {
196 196
         // if the file doesn't exist
197 197
         return redirect()->route('tableIndex')->withErrors([ 'The selected flat file does not exist' ]);
198
-      }
198
+        }
199 199
 
200
-      // 2. Check for file validity and Create the table with schema
201
-      $schema = (new CSVHelper)->schema($fltFleAbsPth);
202
-      // If the file isn't valid return with an error
203
-      if (!$schema) {
200
+        // 2. Check for file validity and Create the table with schema
201
+        $schema = (new CSVHelper)->schema($fltFleAbsPth);
202
+        // If the file isn't valid return with an error
203
+        if (!$schema) {
204 204
         Storage::delete($fltFleAbsPth);
205 205
         return redirect()->route('tableIndex')->withErrors([ 'The selected flat file must be of type: text/plain', 'The selected flat file should not be empty', 'File is deleted for security reasons' ]);
206
-      }
206
+        }
207 207
 
208
-      // 3. Show the users with the schema
209
-      return view('admin.schema')->with('schema', $schema)
210
-                                 ->with('tblNme', $request->slctTblNme)
211
-                                 ->with('fltFile', $request->fltFile2)
212
-                                 ->with('collctnId', $request->colID2);
208
+        // 3. Show the users with the schema
209
+        return view('admin.schema')->with('schema', $schema)
210
+                                    ->with('tblNme', $request->slctTblNme)
211
+                                    ->with('fltFile', $request->fltFile2)
212
+                                    ->with('collctnId', $request->colID2);
213 213
     }
214 214
 
215 215
     public function selectCMSDIS(Request $request) {
216
-      return (new TableHelper)->selectFilesAndImport($this->strDir, $request->colID2, $request->cmsdisFiles2);
216
+        return (new TableHelper)->selectFilesAndImport($this->strDir, $request->colID2, $request->cmsdisFiles2);
217 217
     }
218 218
 
219 219
     /**
220
-    * Method to read input from the schema and start actual data import
221
-    */
220
+     * Method to read input from the schema and start actual data import
221
+     */
222 222
     public function finalize(Request $request) {
223
-      // 1. Get the number of columns, collctn id and table name before creating the table
224
-      $kVal = intval($request->kCnt);
225
-      $tblNme = strval($request->tblNme);
226
-      $fltFile = strval($request->fltFile);
227
-      $collctnId = strval($request->collctnId);
228
-
229
-      // Before anything validate that all the data is strings
230
-      // Define array
231
-      $rules = array();
232
-      // Add rule for each entry in request
233
-      for ($i = 0; $i<$kVal; $i++) {
223
+        // 1. Get the number of columns, collctn id and table name before creating the table
224
+        $kVal = intval($request->kCnt);
225
+        $tblNme = strval($request->tblNme);
226
+        $fltFile = strval($request->fltFile);
227
+        $collctnId = strval($request->collctnId);
228
+
229
+        // Before anything validate that all the data is strings
230
+        // Define array
231
+        $rules = array();
232
+        // Add rule for each entry in request
233
+        for ($i = 0; $i<$kVal; $i++) {
234 234
         // Rules for all names
235 235
         $curNme = 'col-'.$i.'-name';
236 236
         $rules[ $curNme ] = 'required|alpha_dash';
@@ -240,81 +240,81 @@  discard block
 block discarded – undo
240 240
         // Rules for all data sizes
241 241
         $curDataSz = 'col-'.$i.'-size';
242 242
         $rules[ $curDataSz ] = 'required|string';
243
-      }
244
-      // Validate
245
-      $this->validate($request, $rules);
243
+        }
244
+        // Validate
245
+        $this->validate($request, $rules);
246 246
 
247
-      // 2. Create the table
248
-      Schema::connection('mysql')->create($tblNme, function(Blueprint $table) use($kVal, $request){
247
+        // 2. Create the table
248
+        Schema::connection('mysql')->create($tblNme, function(Blueprint $table) use($kVal, $request){
249 249
         // Default primary key
250 250
         $table->increments('id');
251 251
         // Add all the dynamic columns
252 252
         for ($i = 0; $i<$kVal; $i++) {
253
-          // Define current column name, type and size
254
-          $curColNme = strval($request->{'col-'.$i.'-name'});
255
-          $curColType = strval($request->{'col-'.$i.'-data'});
256
-          $curColSze = strval($request->{'col-'.$i.'-size'});
257
-
258
-          // Filter the data type and size and create the column
259
-          // Check for Strings
260
-          if (str_is($curColType, 'string')) {
253
+            // Define current column name, type and size
254
+            $curColNme = strval($request->{'col-'.$i.'-name'});
255
+            $curColType = strval($request->{'col-'.$i.'-data'});
256
+            $curColSze = strval($request->{'col-'.$i.'-size'});
257
+
258
+            // Filter the data type and size and create the column
259
+            // Check for Strings
260
+            if (str_is($curColType, 'string')) {
261 261
             // Check for the data type
262 262
             // Default
263 263
             if (str_is($curColSze, 'default')) {
264
-              // For String default is 30 characters
265
-              $table->string($curColNme, 50)->default("Null");
264
+                // For String default is 30 characters
265
+                $table->string($curColNme, 50)->default("Null");
266 266
             }
267 267
             // Medium
268 268
             if (str_is($curColSze, 'medium')) {
269
-              // For String medium is 150 characters
270
-              $table->string($curColNme, 150)->default("Null");
269
+                // For String medium is 150 characters
270
+                $table->string($curColNme, 150)->default("Null");
271 271
             }
272 272
             // Big
273 273
             if (str_is($curColSze, 'big')) {
274
-              // For String big is 500 characters
275
-              $table->string($curColNme, 500)->default("Null");
274
+                // For String big is 500 characters
275
+                $table->string($curColNme, 500)->default("Null");
276
+            }
276 277
             }
277
-          }
278 278
 
279
-          // Check for Text data type
280
-          if (str_is($curColType, 'text')) {
279
+            // Check for Text data type
280
+            if (str_is($curColType, 'text')) {
281 281
             // Check for the data type
282 282
             // Default
283 283
             if (str_is($curColSze, 'default')) {
284
-              // For text default is text type
285
-              $table->text($curColNme);
284
+                // For text default is text type
285
+                $table->text($curColNme);
286 286
             }
287 287
             // Medium
288 288
             if (str_is($curColSze, 'medium')) {
289
-              // For text medium is mediumtext type
290
-              $table->mediumText($curColNme);
289
+                // For text medium is mediumtext type
290
+                $table->mediumText($curColNme);
291 291
             }
292 292
             // Big
293 293
             if (str_is($curColSze, 'big')) {
294
-              // For text big is longtext type
295
-              $table->longText($curColNme);
294
+                // For text big is longtext type
295
+                $table->longText($curColNme);
296
+            }
296 297
             }
297
-          }
298 298
 
299
-          // Check for Integer
300
-          if (str_is($curColType, 'integer')) {
299
+            // Check for Integer
300
+            if (str_is($curColType, 'integer')) {
301 301
             // Check for the data type
302 302
             // Default
303 303
             if (str_is($curColSze, 'default')) {
304
-              // For Integer default integer type
305
-              $table->integer($curColNme)->default(0);
304
+                // For Integer default integer type
305
+                $table->integer($curColNme)->default(0);
306 306
             }
307 307
             // Medium
308 308
             if (str_is($curColSze, 'medium')) {
309
-              // For Integer medium is medium integer
310
-              $table->mediumInteger($curColNme)->default(0);
309
+                // For Integer medium is medium integer
310
+                $table->mediumInteger($curColNme)->default(0);
311 311
             }
312 312
             // Big
313 313
             if (str_is($curColSze, 'big')) {
314
-              // For Integer big is big integer
315
-              $table->bigInteger($curColNme)->default(0);
314
+                // For Integer big is big integer
315
+                $table->bigInteger($curColNme)->default(0);
316
+            }
316 317
             }
317
-          }
318 318
         }
319 319
 
320 320
         // search index
@@ -322,88 +322,88 @@  discard block
 block discarded – undo
322 322
 
323 323
         // Time stamps
324 324
         $table->timestamps();
325
-      });
325
+        });
326 326
 
327
-      // modify table for fulltext search using the srchindex column
328
-      DB::connection()->getPdo()->exec('ALTER TABLE '.$tblNme.' ADD FULLTEXT fulltext_index (srchindex)');
327
+        // modify table for fulltext search using the srchindex column
328
+        DB::connection()->getPdo()->exec('ALTER TABLE '.$tblNme.' ADD FULLTEXT fulltext_index (srchindex)');
329 329
 
330
-      // Finally create the table
331
-      // Save the table upon the schema
332
-      (new TableHelper)->crteTblInCollctn($tblNme, $collctnId);
330
+        // Finally create the table
331
+        // Save the table upon the schema
332
+        (new TableHelper)->crteTblInCollctn($tblNme, $collctnId);
333 333
 
334
-      // create folder in storage that will contain any additional files associated to the table
335
-      if (Storage::exists($tblNme) == FALSE) {
334
+        // create folder in storage that will contain any additional files associated to the table
335
+        if (Storage::exists($tblNme) == FALSE) {
336 336
         Storage::makeDirectory($tblNme, 0775);
337
-      }
337
+        }
338 338
 
339
-      // Finally return the view to load data
340
-      return $this->load(True, $tblNme, $fltFile);
339
+        // Finally return the view to load data
340
+        return $this->load(True, $tblNme, $fltFile);
341 341
     }
342 342
 
343 343
     /**
344
-    * Method to format the storage files
345
-    **/
344
+     * Method to format the storage files
345
+     **/
346 346
     public function getFiles($strDir) {
347
-      // Get the list of files in the directory
348
-      $fltFleList = Storage::allFiles($strDir);
347
+        // Get the list of files in the directory
348
+        $fltFleList = Storage::allFiles($strDir);
349 349
 
350
-      // Format the file names by truncating the dir
351
-      foreach ($fltFleList as $key => $value) {
350
+        // Format the file names by truncating the dir
351
+        foreach ($fltFleList as $key => $value) {
352 352
         // check if directory string exists in the path
353 353
         if (str_contains($value, $this->strDir.'/')) {
354
-          // replace the string
355
-          $fltFleList[ $key ] = str_replace($this->strDir.'/', '', $value);
354
+            // replace the string
355
+            $fltFleList[ $key ] = str_replace($this->strDir.'/', '', $value);
356
+        }
356 357
         }
357
-      }
358 358
 
359
-      // return the list
360
-      return $fltFleList;
359
+        // return the list
360
+        return $fltFleList;
361 361
     }
362 362
 
363 363
     /**
364
-    * Method responsible to load the data into the given table
365
-    **/
364
+     * Method responsible to load the data into the given table
365
+     **/
366 366
     public function load($isFrwded = False, $tblNme = "", $fltFle = "") {
367
-      // Check if the request is forwarded
368
-      if ($isFrwded) {
367
+        // Check if the request is forwarded
368
+        if ($isFrwded) {
369 369
         // Forward the file and table name
370 370
         $tblNms = Table::where('tblNme', $tblNme)->get();
371 371
         $fltFleList = array($fltFle);
372
-      } else {
372
+        } else {
373 373
         // Get all the tables
374 374
         $tblNms = Table::all();
375 375
         // Get the list of files in the directory
376 376
         $fltFleList = $this->getFiles($this->strDir);
377
-      }
377
+        }
378 378
 
379
-      // Compact them into one array
380
-      $ldData = array(
379
+        // Compact them into one array
380
+        $ldData = array(
381 381
         'tblNms' => $tblNms,
382 382
         'fltFleList' => $fltFleList
383
-      );
383
+        );
384 384
 
385
-      // Simple return the value
386
-      return view('admin.load')->with($ldData);
385
+        // Simple return the value
386
+        return view('admin.load')->with($ldData);
387 387
     }
388 388
 
389 389
     /**
390
-    * Store takes a requested file import and adds it to the job queue for later processing
391
-    **/
390
+     * Store takes a requested file import and adds it to the job queue for later processing
391
+     **/
392 392
     public function store(Request $request) {
393
-      // validate the file name and table name
394
-      // Rules for validation
395
-      $rules = array(
393
+        // validate the file name and table name
394
+        // Rules for validation
395
+        $rules = array(
396 396
         'fltFle' => 'required|string',
397 397
         'tblNme' => 'required|string'
398
-      );
398
+        );
399 399
 
400
-      // Validate the request before storing the job
401
-      $this->validate($request, $rules);
400
+        // Validate the request before storing the job
401
+        $this->validate($request, $rules);
402 402
 
403
-      //Queue Job for Import
404
-      (new TableHelper)->fileImport($request->tblNme, $this->strDir, $request->fltFle);
403
+        //Queue Job for Import
404
+        (new TableHelper)->fileImport($request->tblNme, $this->strDir, $request->fltFle);
405 405
 
406
-      return redirect()->route('tableIndex');
406
+        return redirect()->route('tableIndex');
407 407
     }
408 408
 
409 409
     /**
@@ -439,46 +439,46 @@  discard block
 block discarded – undo
439 439
 
440 440
         // if token count doesn't match what is exptected save the tkns and last row position
441 441
         if (count($tkns) != $orgCount) {
442
-          // save the last row position and the Tokenized row
443
-          $this->lastErrRow = $prcssd;
444
-          $this->savedTkns = $tkns;
445
-          return (null);
442
+            // save the last row position and the Tokenized row
443
+            $this->lastErrRow = $prcssd;
444
+            $this->savedTkns = $tkns;
445
+            return (null);
446 446
         }
447 447
 
448 448
         return ($tkns);
449 449
     }
450 450
 
451 451
     /**
452
-    * Process employs following algorithm:
453
-    * get all the column names from table name
454
-    * 1. Read the file as spl object
455
-    * 2. For each line
456
-    *   1. Validate
457
-    *   2. Insert into database
458
-    **/
452
+     * Process employs following algorithm:
453
+     * get all the column names from table name
454
+     * 1. Read the file as spl object
455
+     * 2. For each line
456
+     *   1. Validate
457
+     *   2. Insert into database
458
+     **/
459 459
     public function process($tblNme, $fltFlePath, $fltFleNme, $ignoreFirst = true) {
460
-      //get table
461
-      $table = Table::where('tblNme', $tblNme)->first();
460
+        //get table
461
+        $table = Table::where('tblNme', $tblNme)->first();
462 462
 
463
-      $clmnLst = $table->getColumnList();
463
+        $clmnLst = $table->getColumnList();
464 464
 
465
-      // remove the id and time stamps
466
-      $clmnLst = array_splice($clmnLst, 1, count($clmnLst) - 3);
465
+        // remove the id and time stamps
466
+        $clmnLst = array_splice($clmnLst, 1, count($clmnLst) - 3);
467 467
 
468
-      // determine number of fields without the srchIndex
469
-      $orgCount = count($clmnLst) - 1;
468
+        // determine number of fields without the srchIndex
469
+        $orgCount = count($clmnLst) - 1;
470 470
 
471
-      // 1. Read the file as spl object
472
-      $fltFleAbsPth = $fltFlePath.'/'.$fltFleNme;
473
-      $fltFleFullPth = storage_path('app/'.$fltFleAbsPth);
471
+        // 1. Read the file as spl object
472
+        $fltFleAbsPth = $fltFlePath.'/'.$fltFleNme;
473
+        $fltFleFullPth = storage_path('app/'.$fltFleAbsPth);
474 474
 
475
-      // Create an instance for the file
476
-      $curFltFleObj = new \SplFileObject($fltFleFullPth);
475
+        // Create an instance for the file
476
+        $curFltFleObj = new \SplFileObject($fltFleFullPth);
477 477
 
478
-      $delimiter = (new CSVHelper)->detectDelimiter($fltFleFullPth);
478
+        $delimiter = (new CSVHelper)->detectDelimiter($fltFleFullPth);
479 479
 
480
-      //Check for an empty file
481
-      if (filesize($fltFleFullPth)>0) {
480
+        //Check for an empty file
481
+        if (filesize($fltFleFullPth)>0) {
482 482
 
483 483
         // Ignore the first line unless set to false
484 484
         if ($ignoreFirst) { $curFltFleObj->seek(1); }
@@ -488,19 +488,19 @@  discard block
 block discarded – undo
488 488
 
489 489
         // For each line
490 490
         while ($curFltFleObj->valid()) {
491
-          // Get the line
492
-          $curLine = $curFltFleObj->current();
491
+            // Get the line
492
+            $curLine = $curFltFleObj->current();
493 493
 
494
-          $tkns = $this->prepareLine($curLine, $delimiter, $orgCount, $prcssd);
494
+            $tkns = $this->prepareLine($curLine, $delimiter, $orgCount, $prcssd);
495 495
 
496
-          // verify that passed $tkns match the expected field count
497
-          if (count($tkns) == $orgCount) {
496
+            // verify that passed $tkns match the expected field count
497
+            if (count($tkns) == $orgCount) {
498 498
             // Declae an array
499 499
             $curArry = array();
500 500
 
501 501
             // Compact them into one array with utf8 encoding
502 502
             for ($i = 0; $i<$orgCount; $i++) {
503
-              $curArry[ strval($clmnLst[ $i ]) ] = utf8_encode($tkns[ $i ]);
503
+                $curArry[ strval($clmnLst[ $i ]) ] = utf8_encode($tkns[ $i ]);
504 504
             }
505 505
 
506 506
             // add srchindex
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
 
509 509
             //insert Record into database
510 510
             $table->insertRecord($curArry);
511
-          }
511
+            }
512 512
 
513
-          // Update the counter
514
-          $prcssd += 1;
515
-          $curFltFleObj->next();
513
+            // Update the counter
514
+            $prcssd += 1;
515
+            $curFltFleObj->next();
516 516
         }
517
-      }
518
-      else {
517
+        }
518
+        else {
519 519
         throw new \Exception("Cannot Import a Empty File.");
520
-      }
520
+        }
521 521
     }
522 522
 
523 523
     /**
524
-    * Disable the given table
525
-    */
524
+     * Disable the given table
525
+     */
526 526
     public function restrict(Request $request) {
527
-      // Create the collection name
528
-      $thisTbl = Table::findOrFail($request->id);
529
-      $thisTbl->hasAccess = false;
530
-      $thisTbl->save();
531
-      return redirect()->route('tableIndex');
527
+        // Create the collection name
528
+        $thisTbl = Table::findOrFail($request->id);
529
+        $thisTbl->hasAccess = false;
530
+        $thisTbl->save();
531
+        return redirect()->route('tableIndex');
532 532
     }
533 533
 
534 534
 }
Please login to merge, or discard this patch.
src/project-css/resources/views/admin/jobs/pending.blade.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
             <th>{{$job->queue}}</th>
38 38
             <th>{{$job->attempts}}</th>
39 39
             {{-- -18000 is the offset for EST time zone --}}
40
-            <th><?php if ($job->reserved_at > 0) { echo gmdate("F j Y, g:i a", $job->reserved_at-18000); }?></th>
41
-            <th><?php if ($job->available_at > 0) { echo gmdate("F j Y, g:i a", $job->available_at-18000); }?></th>
42
-            <th><?php if ($job->created_at > 0) { echo gmdate("F j Y, g:i a", $job->created_at-18000); }?></th>
40
+            <th><?php if ($job->reserved_at>0) { echo gmdate("F j Y, g:i a", $job->reserved_at - 18000); }?></th>
41
+            <th><?php if ($job->available_at>0) { echo gmdate("F j Y, g:i a", $job->available_at - 18000); }?></th>
42
+            <th><?php if ($job->created_at>0) { echo gmdate("F j Y, g:i a", $job->created_at - 18000); }?></th>
43 43
           </tr>
44 44
         @endforeach
45 45
         </table>
Please login to merge, or discard this patch.
src/project-css/resources/views/admin/jobs/failed.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
           <th>{{$job->connection}}</th>
39 39
           <th>{{$job->queue}}</th>
40 40
           <th>{{ str_limit($job->exception, $limit = 100, $end = '...') }}</th>
41
-          <th><?php if ($job->failed_at > 0) { echo gmdate("F j Y, g:i a", (strtotime($job->failed_at)-18000)); }?></th>
41
+          <th><?php if ($job->failed_at>0) { echo gmdate("F j Y, g:i a", (strtotime($job->failed_at) - 18000)); }?></th>
42 42
           <th><a href="{{ url('admin/jobs/retry', [$job->id]) }}" class="btn btn-primary">Retry Job</a></th>
43 43
           <th><a href="{{ url('admin/jobs/forget', [$job->id]) }}" class="btn btn-primary">Delete Job</a></th>
44 44
         </tr>
Please login to merge, or discard this patch.
src/project-css/app/Exceptions/Handler.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@
 block discarded – undo
46 46
             return redirect('/login')->withErrors('Your session has expired. Please try again.');
47 47
         }
48 48
         if ($this->isHttpException($exception)){
49
-          // to get status code ie 404, 503, 500
50
-           $status = $exception->getStatusCode();
49
+            // to get status code ie 404, 503, 500
50
+            $status = $exception->getStatusCode();
51 51
 
52
-           if (view()->exists("errors.{$status}")) {
53
-               return response()->view("errors.{$status}", ['exception' => $exception], $status, $exception->getHeaders());
54
-           } else {
55
-               return $this->convertExceptionToResponse($exception);
56
-           }
52
+            if (view()->exists("errors.{$status}")) {
53
+                return response()->view("errors.{$status}", ['exception' => $exception], $status, $exception->getHeaders());
54
+            } else {
55
+                return $this->convertExceptionToResponse($exception);
56
+            }
57 57
         }
58 58
         return parent::render($request, $exception);
59 59
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@
 block discarded – undo
45 45
         if ($exception instanceof TokenMismatchException) {
46 46
             return redirect('/login')->withErrors('Your session has expired. Please try again.');
47 47
         }
48
-        if ($this->isHttpException($exception)){
48
+        if ($this->isHttpException($exception)) {
49 49
           // to get status code ie 404, 503, 500
50 50
            $status = $exception->getStatusCode();
51 51
 
52 52
            if (view()->exists("errors.{$status}")) {
53
-               return response()->view("errors.{$status}", ['exception' => $exception], $status, $exception->getHeaders());
53
+               return response()->view("errors.{$status}", [ 'exception' => $exception ], $status, $exception->getHeaders());
54 54
            } else {
55 55
                return $this->convertExceptionToResponse($exception);
56 56
            }
Please login to merge, or discard this patch.
src/project-css/app/Http/Middleware/CheckTableId.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,34 +14,34 @@
 block discarded – undo
14 14
      * @return mixed
15 15
      */
16 16
     public function handle($request, Closure $next){
17
-      if ($this->isValidTable($request->curTable) && $this->hasAccess($request->curTable)) {
17
+        if ($this->isValidTable($request->curTable) && $this->hasAccess($request->curTable)) {
18 18
         return $next($request);
19
-      }
20
-      $message = !($this->isValidTable($request->curTable)) ? 'Table id is invalid' : 'Table is disabled';
21
-      return redirect()->route('home')->withErrors([ $message ]);
19
+        }
20
+        $message = !($this->isValidTable($request->curTable)) ? 'Table id is invalid' : 'Table is disabled';
21
+        return redirect()->route('home')->withErrors([ $message ]);
22 22
     }
23 23
 
24 24
     /**
25
-    * The function will check if the passed id is valid using:
26
-    * 1. Check for the null values
27
-    * 2. Check for the non numeric values
28
-    * 3. Check for the table id
29
-    **/
25
+     * The function will check if the passed id is valid using:
26
+     * 1. Check for the null values
27
+     * 2. Check for the non numeric values
28
+     * 3. Check for the table id
29
+     **/
30 30
     public function isValidTable($curTable) {
31
-      if (!is_null($curTable) && is_numeric($curTable)) {
31
+        if (!is_null($curTable) && is_numeric($curTable)) {
32 32
         return Table::find($curTable) == null ? false : true;
33
-      }
34
-      return false;
33
+        }
34
+        return false;
35 35
     }
36 36
 
37 37
     public function hasAccess($curTable) {
38
-      if ($this->isValidTable($curTable)) {
38
+        if ($this->isValidTable($curTable)) {
39 39
         // Get the table entry in meta table "tables"
40 40
         $curTable = Table::find($curTable);
41 41
         if ($curTable->hasAccess == 1) {
42
-          return true;
42
+            return true;
43
+        }
43 44
         }
44
-      }
45
-      return false;
45
+        return false;
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * @param  \Closure  $next
14 14
      * @return mixed
15 15
      */
16
-    public function handle($request, Closure $next){
16
+    public function handle($request, Closure $next) {
17 17
       if ($this->isValidTable($request->curTable) && $this->hasAccess($request->curTable)) {
18 18
         return $next($request);
19 19
       }
Please login to merge, or discard this patch.
src/project-css/app/Http/Controllers/UploadController.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         // return the index page
27 27
         return view('admin/upload')->with('tblNme', $curTable->tblNme)
28
-                                   ->with('tblId', $curTable);
28
+                                    ->with('tblId', $curTable);
29 29
     }
30 30
 
31 31
     /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         //If the array is not empty
48 48
         if ($files[ 0 ] != '') {
49
-          foreach ($files as $file) {
49
+            foreach ($files as $file) {
50 50
             // Set the destination path
51 51
             $destinationPath = $curTable->tblNme.'/'.$upFldNme;
52 52
             Storage::makeDirectory($destinationPath);
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
             $filename = $file->getClientOriginalName();
55 55
 
56 56
             if (Storage::exists($destinationPath.'/'.$filename)) {
57
-              $message = [ 'content' =>  $filename.' Already Exists', 'level' =>  'info' ];
57
+                $message = [ 'content' =>  $filename.' Already Exists', 'level' =>  'info' ];
58 58
             } else {
59
-               // Copy the file in our upload folder
60
-               $file->storeAs($destinationPath, $filename);
59
+                // Copy the file in our upload folder
60
+                $file->storeAs($destinationPath, $filename);
61 61
 
62
-               $message = [
63
-                  'content'  =>  $filename.' Upload successful',
64
-                  'level'    =>  'success',
65
-               ];
62
+                $message = [
63
+                    'content'  =>  $filename.' Upload successful',
64
+                    'level'    =>  'success',
65
+                ];
66 66
             }
67 67
             array_push($messages, $message);
68
-          }
68
+            }
69 69
 
70
-          session()->flash('messages', $messages);
71
-          return view('admin/upload')->with('tblNme', $curTable->tblNme)
72
-                                     ->with('tblId', $curTable);
70
+            session()->flash('messages', $messages);
71
+            return view('admin/upload')->with('tblNme', $curTable->tblNme)
72
+                                        ->with('tblId', $curTable);
73 73
         }
74 74
         return(false);
75 75
     }
Please login to merge, or discard this patch.