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