| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class FileController extends Controller |
||
| 11 | { |
||
| 12 | protected static function getAlias($path) |
||
| 13 | { |
||
| 14 | return \Yii::getAlias("@vendor/carono/yii2-1c-exchange/" . ltrim($path, '/')); |
||
| 15 | } |
||
| 16 | |||
| 17 | protected function out($file, $options = []) |
||
| 18 | { |
||
| 19 | $filename = self::getAlias($file); |
||
| 20 | if (!file_exists($filename)) { |
||
| 21 | throw new FileNotFoundException($filename); |
||
| 22 | } |
||
| 23 | $content = file_get_contents($filename); |
||
| 24 | return \Yii::$app->response->sendContentAsFile($content, basename($filename), $options); |
||
| 25 | } |
||
| 26 | |||
| 27 | protected function outAsFile($file) |
||
| 28 | { |
||
| 29 | return $this->out($file); |
||
| 30 | } |
||
| 31 | |||
| 32 | protected function outAsImage($file) |
||
| 33 | { |
||
| 34 | $options = [ |
||
| 35 | 'inline' => true, |
||
| 36 | 'mimeType' => FileHelper::getMimeType(self::getAlias($file)) |
||
| 37 | ]; |
||
| 38 | return $this->out($file, $options); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function actionArticle($file) |
||
| 44 | } |
||
| 45 | |||
| 46 | public function actionDoc($file) |
||
| 47 | { |
||
| 48 | return $this->outAsImage("/files/doc/$file"); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function actionXml($file) |
||
| 54 | } |
||
| 55 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths