| Conditions | 3 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 6 | public function downloadFile($file, $base64Encode = false) { |
|
| 37 | try { |
||
| 38 | 6 | $this->logger->debug( |
|
| 39 | 6 | "[DownloadService] File to Download: {name}", ['name' => $file->getName()] |
|
| 40 | ); |
||
| 41 | $download = [ |
||
| 42 | 6 | 'preview' => $file->getContent(), |
|
| 43 | 5 | 'mimetype' => $file->getMimeType() |
|
| 44 | ]; |
||
| 45 | |||
| 46 | 5 | if ($base64Encode) { |
|
| 47 | 1 | $download['preview'] = $this->encode($download['preview']); |
|
| 48 | } |
||
| 49 | |||
| 50 | 5 | return $download; |
|
| 51 | 1 | } catch (\Exception $exception) { |
|
| 52 | 1 | throw new NotFoundServiceException('There was a problem accessing the file'); |
|
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 | |||
| 58 |