Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public function run(string $ext) |
||
37 | { |
||
38 | $model = Yii::$app->user->identity; |
||
39 | if (!$model instanceof FileRecord) { |
||
40 | throw new InvalidConfigException( |
||
41 | "The user class must implement " . FileRecord::class |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | return Yii::$app->response->sendFile( |
||
46 | $model->filePath($ext), |
||
47 | $model->fileName($ext), |
||
48 | [ |
||
49 | 'mimeType' => $model->fileMimeType($ext), |
||
50 | 'inline' => !Yii::$app->request |
||
51 | ->getQueryParam($this->downloadParam, false), |
||
52 | ] |
||
57 |