Passed
Pull Request — v1 (#20)
by
unknown
19:49
created
src/services/Transcode.php 2 patches
Indentation   +17 added lines, -17 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)) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
             // skip encoding
210 210
             } elseif (!$generate) {
211
-	            $result = "";
211
+                $result = "";
212 212
             } else {
213 213
                 // Kick off the transcoding
214 214
                 $pid = $this->executeShellCommand($ffmpegCmd);
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
     {
240 240
         $result = null;
241 241
         $settings = Transcoder::$plugin->getSettings();
242
-		$subfolder = '';
242
+        $subfolder = '';
243 243
 
244
-		// sub folder check
245
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
246
-			$subfolder = $filePath->folderPath;
247
-		}
244
+        // sub folder check
245
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
246
+            $subfolder = $filePath->folderPath;
247
+        }
248 248
 
249 249
         $filePath = $this->getAssetPath($filePath);
250 250
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
     {
336 336
         $result = '';
337 337
         $settings = Transcoder::$plugin->getSettings();
338
-		$subfolder = '';
338
+        $subfolder = '';
339 339
 
340
-		// sub folder check
341
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
342
-			$subfolder = $filePath->folderPath;
343
-		}
340
+        // sub folder check
341
+        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
342
+            $subfolder = $filePath->folderPath;
343
+        }
344 344
 
345 345
         $filePath = $this->getAssetPath($filePath);
346 346
 
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
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$subfolder = '';
243 243
 
244 244
 		// sub folder check
245
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
245
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
246 246
 			$subfolder = $filePath->folderPath;
247 247
 		}
248 248
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             if ($asPath) {
315 315
                 $result = $destThumbnailPath;
316 316
             } else {
317
-                $url = $settings['transcoderUrls']['thumbnail'] . $subfolder ?? $settings['transcoderUrls']['default'];
317
+                $url = $settings['transcoderUrls']['thumbnail'].$subfolder ?? $settings['transcoderUrls']['default'];
318 318
                 $result = Craft::getAlias($url).$destThumbnailFile;
319 319
             }
320 320
         }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		$subfolder = '';
339 339
 
340 340
 		// sub folder check
341
-		if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
341
+		if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
342 342
 			$subfolder = $filePath->folderPath;
343 343
 		}
344 344
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
             // If the audio file already exists and hasn't been modified, return it.  Otherwise, start it transcoding
416 416
             if ($this->shouldGenerateAsset('audio', $destAudioPath, $filePath)) {
417
-                $url = $settings['transcoderUrls']['audio'] . $subfolder ?? $settings['transcoderUrls']['default'];
417
+                $url = $settings['transcoderUrls']['audio'].$subfolder ?? $settings['transcoderUrls']['default'];
418 418
                 $result = Craft::getAlias($url).$destAudioFile;
419 419
 
420 420
                 if ($remoteUrl = $this->moveAssetToVolume('audio', $destAudioPath)) {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                     && (strpos($summaryResult['videoFrameRate'], '/') !== false)
496 496
                 ) {
497 497
                     $parts = explode('/', $summaryResult['videoFrameRate']);
498
-                    $summaryResult['videoFrameRate'] = (float)$parts[0] / (float)$parts[1];
498
+                    $summaryResult['videoFrameRate'] = (float) $parts[0] / (float) $parts[1];
499 499
                 }
500 500
                 $result = $summaryResult;
501 501
             }
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
         $subfolder = '';
608 608
 
609 609
         // sub folder check
610
-        if(\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
610
+        if (\is_object($filePath) && ($filePath instanceof Asset) && $settings['createSubfolders']) {
611 611
             $subfolder = $filePath->folderPath;
612 612
         }
613 613
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 
669 669
             // If the video file already exists and hasn't been modified, return it.  Otherwise, start it transcoding
670 670
             if ($this->shouldGenerateAsset('gif', $destVideoPath, $filePath)) {
671
-                $url = $settings['transcoderUrls']['gif'] . $subfolder ?? $settings['transcoderUrls']['default'];
671
+                $url = $settings['transcoderUrls']['gif'].$subfolder ?? $settings['transcoderUrls']['default'];
672 672
                 $result = Craft::getAlias($url).$destVideoFile;
673 673
 
674 674
                 if ($remoteUrl = $this->moveAssetToVolume('gif', $destVideoPath)) {
@@ -758,14 +758,14 @@  discard block
 block discarded – undo
758 758
                 // If it's local, get a path to the file
759 759
                 if ($assetVolume instanceof Local) {
760 760
                     $sourcePath = rtrim($assetVolume->path, DIRECTORY_SEPARATOR);
761
-                    $sourcePath .= '' === $sourcePath ? '': DIRECTORY_SEPARATOR;
761
+                    $sourcePath .= '' === $sourcePath ? '' : DIRECTORY_SEPARATOR;
762 762
                     $folderPath = '';
763 763
                     try {
764 764
                         $folderPath = rtrim($asset->getFolder()->path, DIRECTORY_SEPARATOR);
765 765
                     } catch (InvalidConfigException $e) {
766 766
                         Craft::error($e->getMessage(), __METHOD__);
767 767
                     }
768
-                    $folderPath .= '' === $folderPath ? '': DIRECTORY_SEPARATOR;
768
+                    $folderPath .= '' === $folderPath ? '' : DIRECTORY_SEPARATOR;
769 769
 
770 770
                     $filePath = $sourcePath.$folderPath.$asset->filename;
771 771
                 } else {
Please login to merge, or discard this patch.