Passed
Pull Request — v1 (#20)
by
unknown
04:43
created
src/services/Transcode.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 
98 98
         $result = '';
99 99
         $settings = Transcoder::$plugin->getSettings();
100
-		$subfolder = '';
100
+        $subfolder = '';
101 101
 
102
-		// sub folder check
103
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
104
-			$subfolder = $filePath->folderPath;
105
-		}
102
+        // sub folder check
103
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
104
+            $subfolder = $filePath->folderPath;
105
+        }
106 106
 
107
-		// file path
107
+        // file path
108 108
         $filePath = $this->getAssetPath($filePath);
109 109
 
110 110
         if (!empty($filePath)) {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
             // skip encoding
206 206
             } elseif (!$generate) {
207
-	            $result = "";
207
+                $result = "";
208 208
             } else {
209 209
                 // Kick off the transcoding
210 210
                 $pid = $this->executeShellCommand($ffmpegCmd);
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
     {
239 239
         $result = null;
240 240
         $settings = Transcoder::$plugin->getSettings();
241
-		$subfolder = '';
241
+        $subfolder = '';
242 242
 
243
-		// sub folder check
244
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
245
-			$subfolder = $filePath->folderPath;
246
-		}
243
+        // sub folder check
244
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
245
+            $subfolder = $filePath->folderPath;
246
+        }
247 247
 
248 248
         $filePath = $this->getAssetPath($filePath);
249 249
 
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
     {
335 335
         $result = '';
336 336
         $settings = Transcoder::$plugin->getSettings();
337
-		$subfolder = '';
337
+        $subfolder = '';
338 338
 
339
-		// sub folder check
340
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
341
-			$subfolder = $filePath->folderPath;
342
-		}
339
+        // sub folder check
340
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
341
+            $subfolder = $filePath->folderPath;
342
+        }
343 343
 
344 344
         $filePath = $this->getAssetPath($filePath);
345 345
 
@@ -603,12 +603,12 @@  discard block
 block discarded – undo
603 603
     {
604 604
         $result = '';
605 605
         $settings = Transcoder::$plugin->getSettings();
606
-		$subfolder = '';
606
+        $subfolder = '';
607 607
 
608
-		// sub folder check
609
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
610
-			$subfolder = $filePath->folderPath;
611
-		}
608
+        // sub folder check
609
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
610
+            $subfolder = $filePath->folderPath;
611
+        }
612 612
 
613 613
         $filePath = $this->getAssetPath($filePath);
614 614
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$subfolder = '';
101 101
 
102 102
 		// sub folder check
103
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
103
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
104 104
 			$subfolder = $filePath->folderPath;
105 105
 		}
106 106
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$subfolder = '';
242 242
 
243 243
 		// sub folder check
244
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
244
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
245 245
 			$subfolder = $filePath->folderPath;
246 246
 		}
247 247
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             if ($asPath) {
314 314
                 $result = $destThumbnailPath;
315 315
             } else {
316
-                $url = $settings['transcoderUrls']['thumbnail'] . $subfolder ?? $settings['transcoderUrls']['default'];
316
+                $url = $settings['transcoderUrls']['thumbnail'].$subfolder ?? $settings['transcoderUrls']['default'];
317 317
                 $result = Craft::getAlias($url).$destThumbnailFile;
318 318
             }
319 319
         }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$subfolder = '';
338 338
 
339 339
 		// sub folder check
340
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
340
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
341 341
 			$subfolder = $filePath->folderPath;
342 342
 		}
343 343
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
             // If the audio file already exists and hasn't been modified, return it.  Otherwise, start it transcoding
415 415
             if ($this->shouldGenerateAsset('audio', $destAudioPath, $filePath)) {
416
-                $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default'];
416
+                $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default'];
417 417
                 $result = Craft::getAlias($url).$destAudioFile;
418 418
             } else {
419 419
                 // Kick off the transcoding
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                     && (strpos($summaryResult['videoFrameRate'], '/') !== false)
495 495
                 ) {
496 496
                     $parts = explode('/', $summaryResult['videoFrameRate']);
497
-                    $summaryResult['videoFrameRate'] = (float)$parts[0] / (float)$parts[1];
497
+                    $summaryResult['videoFrameRate'] = (float) $parts[0] / (float) $parts[1];
498 498
                 }
499 499
                 $result = $summaryResult;
500 500
             }
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		$subfolder = '';
607 607
 
608 608
 		// sub folder check
609
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
609
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
610 610
 			$subfolder = $filePath->folderPath;
611 611
 		}
612 612
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 
668 668
             // If the video file already exists and hasn't been modified, return it.  Otherwise, start it transcoding
669 669
             if ($this->shouldGenerateAsset('gif', $destVideoPath, $filePath)) {
670
-                $url = $settings['transcoderUrls']['gif'] . $subfolder ?? $settings['transcoderUrls']['default'];
670
+                $url = $settings['transcoderUrls']['gif'].$subfolder ?? $settings['transcoderUrls']['default'];
671 671
                 $result = Craft::getAlias($url).$destVideoFile;
672 672
             } else {
673 673
                 // Kick off the transcoding
@@ -757,14 +757,14 @@  discard block
 block discarded – undo
757 757
                 // If it's local, get a path to the file
758 758
                 if ($assetVolume instanceof Local) {
759 759
                     $sourcePath = rtrim($assetVolume->path, DIRECTORY_SEPARATOR);
760
-                    $sourcePath .= '' === $sourcePath ? '': DIRECTORY_SEPARATOR;
760
+                    $sourcePath .= '' === $sourcePath ? '' : DIRECTORY_SEPARATOR;
761 761
                     $folderPath = '';
762 762
                     try {
763 763
                         $folderPath = rtrim($asset->getFolder()->path, DIRECTORY_SEPARATOR);
764 764
                     } catch (InvalidConfigException $e) {
765 765
                         Craft::error($e->getMessage(), __METHOD__);
766 766
                     }
767
-                    $folderPath .= '' === $folderPath ? '': DIRECTORY_SEPARATOR;
767
+                    $folderPath .= '' === $folderPath ? '' : DIRECTORY_SEPARATOR;
768 768
 
769 769
                     $filePath = $sourcePath.$folderPath.$asset->filename;
770 770
                 } else {
Please login to merge, or discard this patch.