| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3.0067 |
| 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 | 1 | $nbHeaders = count($headers); |
|
| 30 | |||
| 31 | 1 | $datas = []; |
|
| 32 | 1 | while (!$file->eof()) { |
|
| 33 | 1 | $csvData = $file->fgetcsv(); |
|
| 34 | 1 | if (count($csvData) != $nbHeaders) { |
|
| 35 | continue; |
||
| 36 | } |
||
| 37 | 1 | $datas[] = array_combine($headers, $csvData); |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | return $datas; |
|
| 41 | } |
||
| 42 | } |
||
| 43 |