Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
23 | 1 | protected function extractFileContent($filepath) |
|
24 | { |
||
25 | 1 | $file = new \SplFileObject($filepath); |
|
26 | |||
27 | //csv file have to be formatted with headers on the first line |
||
28 | 1 | $headers = $file->fgetcsv(); |
|
29 | |||
30 | 1 | $data = []; |
|
31 | 1 | while (!$file->eof()) { |
|
32 | 1 | $data[] = array_combine($headers, $file->fgetcsv()); |
|
33 | } |
||
34 | |||
35 | 1 | return $data; |
|
36 | } |
||
37 | } |
||
38 |