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

FileContent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 7 2
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