Passed
Push — master ( ae009e...1bc377 )
by 世昌
02:06
created

FileContent::send()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
namespace nebula\application\response\provider\type;
3
4
use SplFileInfo;
5
6
/**
7
 * 响应接口
8
 */
9
class FileContent implements TypeContentInterface
10
{
11
    /**
12
     * 输出文件
13
     *
14
     * @param SplFileInfo $content
15
     * @param string $type
16
     * @return void
17
     */
18
    public static function send($content, string $type)
19
    {
20
        if ($content->isFile()) {
21
            Response::instance()->setType($content->getExtension());
0 ignored issues
show
Bug introduced by
The type nebula\application\response\provider\type\Response was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
            Response::instance()->send(file_get_contents($content->getRealPath()));
23
        } else {
24
            throw new \Exception('returned SplFileInfo must be file');
25
        }
26
    }
27
}
28