JpasImport   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 25
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFile() 0 15 2
A getFilters() 0 6 1
1
<?php
2
3
namespace SET\Handlers\Excel;
4
5
use Illuminate\Support\Facades\File;
6
use Illuminate\Support\Facades\Input;
7
use Illuminate\Support\Facades\Storage;
8
use Maatwebsite\Excel\Files\ExcelFile;
9
10
class JpasImport extends ExcelFile
11
{
12
    public function getFile()
13
    {
14
        //If we pass a filepath, use it and get out
15
        if (Input::has('uploadedFile')) {
16
            return Input::get('uploadedFile');
17
        }
18
        //Process the excel file provided.
19
        $file = Input::file('file');
20
        $fileName = $file->getClientOriginalName();
21
        Storage::disk('local')->put($fileName, File::get($file));
22
23
        $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
24
25
        return $storagePath.$fileName;
26
    }
27
28
    public function getFilters()
29
    {
30
        return [
31
            'chunk',
32
        ];
33
    }
34
}
35