| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function parse($path) { |
||
| 16 | $data = []; |
||
| 17 | $path = trim($path, '/'); |
||
| 18 | $finder = new Finder(); |
||
| 19 | $files = $finder->files()->in("{$this->root}/data/{$path}")->name('*.*'); |
||
| 20 | $factory = new ParserFactory(); |
||
| 21 | |||
| 22 | foreach ($files as $file) { |
||
| 23 | $parser = $factory->getParser($file->getFilename()); |
||
| 24 | |||
| 25 | $id = str_replace(".{$file->getExtension()}", '', $file->getFilename()); |
||
| 26 | |||
| 27 | $data[$id] = $parser->parse($file->getRelativePathname()); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $data; |
||
| 31 | } |
||
| 32 | } |
||
| 33 |