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