Passed
Push — develop ( c4488a...0835a7 )
by Andrew
04:33
created
src/controllers/DefaultController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
     public function actionDownloadFile($url)
50 50
     {
51 51
         $filePath = parse_url($url, PHP_URL_PATH);
52
-        $filePath = $_SERVER['DOCUMENT_ROOT'].$filePath;
52
+        $filePath = $_SERVER[ 'DOCUMENT_ROOT' ] . $filePath;
53 53
         Craft::$app->getResponse()->sendFile(
54 54
             $filePath,
55 55
             null,
56
-            ['inline' => false]
56
+            [ 'inline' => false ]
57 57
         );
58 58
         Craft::$app->end();
59 59
     }
@@ -72,24 +72,24 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function actionProgress($filename)
74 74
     {
75
-        $result = [];
76
-        $progressFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$filename.'.progress';
75
+        $result = [ ];
76
+        $progressFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename . '.progress';
77 77
         if (file_exists($progressFile)) {
78 78
             $content = @file_get_contents($progressFile);
79 79
             if ($content) {
80 80
                 // get duration of source
81 81
                 preg_match('/Duration: (.*?), start:/', $content, $matches);
82 82
                 if (\count($matches) > 0) {
83
-                    $rawDuration = $matches[1];
83
+                    $rawDuration = $matches[ 1 ];
84 84
 
85 85
                     // rawDuration is in 00:00:00.00 format. This converts it to seconds.
86 86
                     $ar = array_reverse(explode(':', $rawDuration));
87
-                    $duration = (float)$ar[0];
88
-                    if (!empty($ar[1])) {
89
-                        $duration += (int)$ar[1] * 60;
87
+                    $duration = (float) $ar[ 0 ];
88
+                    if (!empty($ar[ 1 ])) {
89
+                        $duration += (int) $ar[ 1 ] * 60;
90 90
                     }
91
-                    if (!empty($ar[2])) {
92
-                        $duration += (int)$ar[2] * 60 * 60;
91
+                    if (!empty($ar[ 2 ])) {
92
+                        $duration += (int) $ar[ 2 ] * 60 * 60;
93 93
                     }
94 94
                 } else {
95 95
                     $duration = 'unknown'; // with GIF as input, duration is unknown
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 
107 107
                 //rawTime is in 00:00:00.00 format. This converts it to seconds.
108 108
                 $ar = array_reverse(explode(':', $rawTime));
109
-                $time = (float)$ar[0];
110
-                if (!empty($ar[1])) {
111
-                    $time += (int)$ar[1] * 60;
109
+                $time = (float) $ar[ 0 ];
110
+                if (!empty($ar[ 1 ])) {
111
+                    $time += (int) $ar[ 1 ] * 60;
112 112
                 }
113
-                if (!empty($ar[2])) {
114
-                    $time += (int)$ar[2] * 60 * 60;
113
+                if (!empty($ar[ 2 ])) {
114
+                    $time += (int) $ar[ 2 ] * 60 * 60;
115 115
                 }
116 116
 
117 117
                 //calculate the progress
Please login to merge, or discard this patch.