Passed
Push — master ( 202650...07fd2b )
by Iman
02:11
created
src/VideoStreamer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
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
         }
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             $c_start = $range[0];
66 66
 
67 67
             if (isset($range[1]) && is_numeric($range[1])) {
68
-                \Log::info('$range:'.$range[1].gettype($range[1]));
68
+                \Log::info('$range:' . $range[1] . gettype($range[1]));
69 69
             } else {
70
-                \Log::info('default: '.$c_end);
70
+                \Log::info('default: ' . $c_end);
71 71
             }
72 72
 
73 73
             $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $c_end;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
         $length = $this->end - $this->start + 1;
84 84
         fseek($this->stream, $this->start);
85 85
         header('HTTP/1.1 206 Partial Content');
86
-        header('Content-Length: '.$length);
87
-        header("Content-Range: bytes $this->start-$this->end/".$this->size);
86
+        header('Content-Length: ' . $length);
87
+        header("Content-Range: bytes $this->start-$this->end/" . $this->size);
88 88
     }
89 89
 
90 90
     /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $i = $this->start;
96 96
         set_time_limit(0);
97 97
         $readBytes = 0;
98
-        while (! feof($this->stream) && ($i <= $this->end) && ($readBytes < ($this->buffer * 4))) {
98
+        while (!feof($this->stream) && ($i <= $this->end) && ($readBytes < ($this->buffer * 4))) {
99 99
             $bytesToRead = $this->buffer;
100 100
             if (($i + $bytesToRead) > $this->end) {
101 101
                 $bytesToRead = $this->end - $i + 1;
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
     public static function streamFile($path)
127 127
     {
128 128
         $stream = fopen($path, 'rb');
129
-        if (! $stream) {
130
-            throw new \Exception('File not found in: '.$path, 6542);
129
+        if (!$stream) {
130
+            throw new \Exception('File not found in: ' . $path, 6542);
131 131
         }
132 132
 
133 133
         (new static($path, $stream))->start();
Please login to merge, or discard this patch.