Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
24 | 1 | protected function processFile($filename, $data) |
|
25 | { |
||
26 | 1 | $filepath = $this->getFolderToLoad() . DIRECTORY_SEPARATOR . $filename . '.' . $this->fileExtension; |
|
27 | 1 | if (!is_dir(dirname($filepath))) { |
|
28 | 1 | mkdir(dirname($filepath), 0700, true); |
|
29 | } |
||
30 | 1 | $fp = fopen($filepath, 'w'); |
|
31 | |||
32 | //write headers |
||
33 | 1 | fputcsv($fp, array_keys($data[0]), ',', '"'); |
|
34 | 1 | foreach ($data as $row) { |
|
35 | 1 | fputcsv($fp, $row); |
|
36 | } |
||
37 | 1 | fclose($fp); |
|
38 | 1 | } |
|
39 | } |
||
40 |