1 | <?php |
||
13 | class FileParser |
||
14 | { |
||
15 | /** |
||
16 | * @var StructMapper |
||
17 | */ |
||
18 | private $structMapper; |
||
19 | |||
20 | /** |
||
21 | * FileParser constructor. |
||
22 | * |
||
23 | * @param StructMapper $structMapper |
||
24 | */ |
||
25 | public function __construct(StructMapper $structMapper) |
||
29 | |||
30 | /** |
||
31 | * Parses the given file |
||
32 | * |
||
33 | * @param File $file |
||
34 | * |
||
35 | * @return array |
||
36 | * |
||
37 | * @throws FileFormatException |
||
38 | */ |
||
39 | public function parseFile(File $file) |
||
47 | |||
48 | /** |
||
49 | * Fetches the content of the file and returns it. |
||
50 | * |
||
51 | * @param File $file |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | private function getSanitizedFileContent(File $file) |
||
64 | |||
65 | /** |
||
66 | * Fetches rows from csv content. |
||
67 | * |
||
68 | * @param string $content |
||
69 | * |
||
70 | * @return array |
||
71 | * |
||
72 | * @throws FileFormatException |
||
73 | */ |
||
74 | private function getRowsFromCsv($content) |
||
94 | } |
||
95 |