| Conditions | 7 |
| Paths | 7 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 7 | public static function fileExtensionToFormat($ext) |
|
| 38 | { |
||
| 39 | //defaults |
||
| 40 | switch ($ext) { |
||
| 41 | 7 | case 'zip': |
|
| 42 | /*if ($subInformation) { |
||
| 43 | list($subMimeType, $subFile) = explode('@', $subInformation); |
||
| 44 | |||
| 45 | return new CompressedFormat($subFile, 'zip', $this->mimeTypeToFormat($subMimeType)); |
||
| 46 | } else {*/ |
||
| 47 | |||
| 48 | 1 | return new CompressedFormat(); |
|
| 49 | //} |
||
| 50 | 6 | case 'csv': |
|
| 51 | 5 | case 'txt': |
|
| 52 | 2 | return new CsvFormat(); |
|
| 53 | 4 | case 'xls': |
|
| 54 | 3 | case 'xlsx': |
|
| 55 | 2 | return new ExcelFormat(); |
|
| 56 | 2 | case 'xml': |
|
| 57 | 1 | return new XmlFormat(); |
|
| 58 | default: |
||
| 59 | 1 | throw new InvalidConfigurationException("Unknown file-extension: '$ext'."); |
|
| 60 | } |
||
| 61 | } |
||
| 62 | } |
||
| 63 |