@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | private function setHeader() |
| 32 | 32 | { |
| 33 | 33 | ob_get_clean(); |
| 34 | - header('Content-Type: '.$this->mime); |
|
| 34 | + header('Content-Type: ' . $this->mime); |
|
| 35 | 35 | header('Cache-Control: max-age=2592000, public'); |
| 36 | - header('Expires: '.gmdate('D, d M Y H:i:s', time() + 2592000).' GMT'); |
|
| 37 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', @filemtime($this->path)).' GMT'); |
|
| 36 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2592000) . ' GMT'); |
|
| 37 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', @filemtime($this->path)) . ' GMT'); |
|
| 38 | 38 | $this->start = 0; |
| 39 | 39 | $this->size = filesize($this->path); |
| 40 | 40 | $this->end = $this->size - 1; |
| 41 | - header('Accept-Ranges: 0-'.$this->end); |
|
| 41 | + header('Accept-Ranges: 0-' . $this->end); |
|
| 42 | 42 | |
| 43 | - if (! isset($_SERVER['HTTP_RANGE'])) { |
|
| 44 | - header('Content-Length: '.$this->size); |
|
| 43 | + if (!isset($_SERVER['HTTP_RANGE'])) { |
|
| 44 | + header('Content-Length: ' . $this->size); |
|
| 45 | 45 | |
| 46 | 46 | return; |
| 47 | 47 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | $length = $this->end - $this->start + 1; |
| 78 | 78 | fseek($this->stream, $this->start); |
| 79 | 79 | header('HTTP/1.1 206 Partial Content'); |
| 80 | - header('Content-Length: '.$length); |
|
| 81 | - header("Content-Range: bytes $this->start-$this->end/".$this->size); |
|
| 80 | + header('Content-Length: ' . $length); |
|
| 81 | + header("Content-Range: bytes $this->start-$this->end/" . $this->size); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $i = $this->start; |
| 99 | 99 | set_time_limit(0); |
| 100 | - while (! feof($this->stream) && $i <= $this->end) { |
|
| 100 | + while (!feof($this->stream) && $i <= $this->end) { |
|
| 101 | 101 | $bytesToRead = $this->buffer; |
| 102 | 102 | if (($i + $bytesToRead) > $this->end) { |
| 103 | 103 | $bytesToRead = $this->end - $i + 1; |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | public static function streamFile($path) |
| 123 | 123 | { |
| 124 | 124 | $stream = fopen($path, 'rb'); |
| 125 | - if (! $stream) { |
|
| 126 | - throw new \Exception('File not found in: '.$path, 6542); |
|
| 125 | + if (!$stream) { |
|
| 126 | + throw new \Exception('File not found in: ' . $path, 6542); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | (new static($path, $stream))->start(); |