Total Complexity | 8 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 90.48% |
Changes | 0 |
1 | <?php |
||
7 | class BinaryFileResponse extends BaseBinaryFileResponse |
||
8 | { |
||
9 | /** |
||
10 | * @var \Swis\Laravel\Encrypted\File |
||
11 | */ |
||
12 | protected $file; |
||
13 | |||
14 | /** |
||
15 | * {@inheritdoc} |
||
16 | */ |
||
17 | 15 | public function setFile( |
|
18 | $file, |
||
19 | string $contentDisposition = null, |
||
20 | bool $autoEtag = false, |
||
21 | bool $autoLastModified = true |
||
22 | ) { |
||
23 | // Wrap the file in our own \Swis\Laravel\Encrypted\File class. |
||
24 | 15 | if (!$file instanceof File) { |
|
25 | 15 | if ($file instanceof \SplFileInfo) { |
|
26 | 3 | $file = new File($file->getPathname()); |
|
27 | } else { |
||
28 | 12 | $file = new File((string) $file); |
|
29 | } |
||
30 | } |
||
31 | |||
32 | 15 | return parent::setFile($file, $contentDisposition, $autoEtag, $autoLastModified); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 6 | public function sendContent() |
|
65 | } |
||
66 | } |
||
67 |