Conditions | 11 |
Paths | 32 |
Total Lines | 47 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
59 | private function setHeader() { |
||
60 | header("Content-Type: " . $this->mimeType . "; charset=utf-8"); |
||
61 | header("Cache-Control: max-age=2592000, public"); |
||
62 | header("Expires: " . gmdate('D, d M Y H:i:s', time() + 2592000) . ' GMT'); |
||
63 | header("Last-Modified: " . gmdate('D, d M Y H:i:s', $this -> mTime) . ' GMT'); |
||
64 | |||
65 | $this -> iStart = 0; |
||
66 | $this -> iEnd = $this -> iSize - 1; |
||
67 | |||
68 | if (isset($_SERVER['HTTP_RANGE'])) { |
||
69 | $c_end = $this -> iEnd; |
||
70 | $this->isStream = true; |
||
71 | |||
72 | list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); |
||
73 | |||
74 | if (strpos($range, ',') !== false) { |
||
75 | http_response_code(416); |
||
76 | header("Content-Range: bytes ".$this->iStart."-".$this->iEnd."/".$this->iSize); |
||
77 | exit ; |
||
78 | } |
||
79 | if ($range === '-') { |
||
80 | $c_start = $this -> iSize - substr($range, 1); |
||
81 | } else { |
||
82 | $range = explode('-', $range); |
||
83 | $c_start = $range[0]; |
||
84 | $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $c_end; |
||
85 | } |
||
86 | $c_end = ($c_end > $this -> iEnd) ? $this -> iEnd : $c_end; |
||
87 | if ($c_start > $c_end || $c_start > $this -> iSize - 1 || $c_end >= $this -> iSize) { |
||
88 | http_response_code(416); |
||
89 | header("Content-Range: bytes ".$this->iStart."-".$this->iEnd."/".$this->iSize); |
||
90 | exit ; |
||
91 | } |
||
92 | $this -> iStart = $c_start; |
||
93 | $this -> iEnd = $c_end; |
||
94 | $length = $c_end - $c_start + 1; |
||
95 | if($this -> iStart > 0){ |
||
96 | fseek($this -> stream, $this -> iStart); |
||
97 | } |
||
98 | header("Accept-Ranges: bytes"); |
||
99 | header("Content-Length: $length"); |
||
100 | http_response_code(206); |
||
101 | header("Content-Range: bytes ".$this->iStart."-".$this->iEnd."/".$this->iSize); |
||
102 | //\OCP\Util::writeLog('audioplayer','SEQ:'.$this->iStart."-".$this->iEnd."/".$this->iSize.'length:'.$length,\OCP\Util::DEBUG); |
||
103 | } else { |
||
104 | header("Content-Length: " . $this -> iSize); |
||
105 | $this->isStream = false; |
||
106 | |||
156 | } |
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