1 | <?php |
||||||
2 | |||||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||||
3 | namespace Hhxsv5\LaravelS\Swoole; |
||||||
4 | |||||||
5 | use Symfony\Component\HttpFoundation\StreamedResponse; |
||||||
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\StreamedResponse 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
6 | |||||||
7 | class DynamicResponse extends Response |
||||||
0 ignored issues
–
show
|
|||||||
8 | { |
||||||
9 | /** |
||||||
0 ignored issues
–
show
|
|||||||
10 | * @throws \Exception |
||||||
11 | */ |
||||||
0 ignored issues
–
show
|
|||||||
12 | public function gzip() |
||||||
13 | { |
||||||
14 | if (extension_loaded('zlib')) { |
||||||
15 | $this->swooleResponse->gzip(2); |
||||||
0 ignored issues
–
show
The method
gzip() does not exist on Swoole\Http\Response .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
16 | } else { |
||||||
17 | throw new \RuntimeException('Http GZIP requires library "zlib", use "php --ri zlib" to check.'); |
||||||
18 | } |
||||||
19 | } |
||||||
20 | |||||||
21 | public function sendContent() |
||||||
0 ignored issues
–
show
|
|||||||
22 | { |
||||||
23 | if ($this->laravelResponse instanceof StreamedResponse) { |
||||||
24 | ob_start(); |
||||||
25 | $this->laravelResponse = $this->laravelResponse->sendContent(); |
||||||
26 | $content = ob_get_clean(); |
||||||
27 | } else { |
||||||
28 | $content = $this->laravelResponse->getContent(); |
||||||
29 | } |
||||||
30 | |||||||
31 | $len = strlen($content); |
||||||
32 | if ($len === 0) { |
||||||
33 | $this->swooleResponse->end(); |
||||||
34 | return; |
||||||
35 | } |
||||||
36 | |||||||
37 | if ($len > $this->chunkLimit) { |
||||||
38 | for ($offset = 0, $limit = (int)(0.6 * $this->chunkLimit); $offset < $len; $offset += $limit) { |
||||||
39 | $chunk = substr($content, $offset, $limit); |
||||||
40 | $this->swooleResponse->write($chunk); |
||||||
41 | } |
||||||
42 | $this->swooleResponse->end(); |
||||||
43 | } else { |
||||||
44 | $this->swooleResponse->end($content); |
||||||
45 | } |
||||||
46 | } |
||||||
47 | } |