Passed
Pull Request — develop (#85)
by
unknown
06:16
created
src/web/assets/videos/VideosAsset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         ];
29 29
 
30 30
         if (!Plugin::getInstance()->getVideos()->useDevServer) {
31
-            $this->sourcePath = __DIR__ . '/dist';
31
+            $this->sourcePath = __DIR__.'/dist';
32 32
             $this->js[] = 'main.js';
33 33
             $this->css[] = 'css/main.css';
34 34
         } else {
Please login to merge, or discard this patch.
src/web/twig/variables/VideosVariable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         try {
43 43
             return Videos::$plugin->getVideos()->getVideoByUrl($videoUrl, $enableCache, $cacheExpiry);
44 44
         } catch (\Exception $exception) {
45
-            Craft::info('Couldn’t get video from its url (' . $videoUrl . '): ' . $exception->getMessage(), __METHOD__);
45
+            Craft::info('Couldn’t get video from its url ('.$videoUrl.'): '.$exception->getMessage(), __METHOD__);
46 46
         }
47 47
 
48 48
         return null;
Please login to merge, or discard this patch.
src/Plugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@
 block discarded – undo
176 176
             $event->options[] = [
177 177
                 'key' => 'videos-caches',
178 178
                 'label' => Craft::t('videos', 'Videos caches'),
179
-                'action' => Craft::$app->path->getRuntimePath() . '/videos'
179
+                'action' => Craft::$app->path->getRuntimePath().'/videos'
180 180
             ];
181 181
         });
182 182
     }
Please login to merge, or discard this patch.
src/services/Cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,6 +88,6 @@
 block discarded – undo
88 88
 
89 89
         $hash = md5(serialize($request));
90 90
 
91
-        return 'videos.' . $hash;
91
+        return 'videos.'.$hash;
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
src/migrations/m200925_135118_refactor_oauth_provider_options.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 
37 37
             // Rebuild OAuth provider options
38 38
             foreach ($oauthProviderOptions as $providerHandle => $provider) {
39
-                $projectConfig->set('plugins.videos.settings.oauthProviderOptions.' . $providerHandle, $provider, sprintf('Save the “%s” provider', $providerHandle));
39
+                $projectConfig->set('plugins.videos.settings.oauthProviderOptions.'.$providerHandle, $provider, sprintf('Save the “%s” provider', $providerHandle));
40 40
             }
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
src/controllers/SettingsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
         ];
136 136
 
137 137
         $key = 'plugins.videos.settings.oauthProviderOptions';
138
-        $configPath = $key . '.' . $gateway->getHandle();
138
+        $configPath = $key.'.'.$gateway->getHandle();
139 139
 
140 140
         Craft::$app->getProjectConfig()->set($configPath, $configData, sprintf('Save the “%s” integration', $gateway->getHandle()));
141 141
 
Please login to merge, or discard this patch.
src/fields/Video.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         $id = Html::id($name);
56 56
 
57 57
         // Init CSRF Token
58
-        $jsTemplate = 'window.csrfTokenName = "' . Craft::$app->getConfig()->getGeneral()->csrfTokenName . '";';
59
-        $jsTemplate .= 'window.csrfTokenValue = "' . Craft::$app->getRequest()->getCsrfToken() . '";';
58
+        $jsTemplate = 'window.csrfTokenName = "'.Craft::$app->getConfig()->getGeneral()->csrfTokenName.'";';
59
+        $jsTemplate .= 'window.csrfTokenValue = "'.Craft::$app->getRequest()->getCsrfToken().'";';
60 60
         $js = $view->renderString($jsTemplate);
61 61
         $view->registerJs($js);
62 62
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         // Instantiate Videos Field
94 94
         // $view->registerJs('new Videos.Field("'.$view->namespaceInputId($id).'");');
95
-        $view->registerJs('new VideoFieldConstructor({data: {fieldVariables: ' . \json_encode($variables) . '}}).$mount("#' . $view->namespaceInputId($id) . '-vue");');
95
+        $view->registerJs('new VideoFieldConstructor({data: {fieldVariables: '.\json_encode($variables).'}}).$mount("#'.$view->namespaceInputId($id).'-vue");');
96 96
 
97 97
         return $view->renderTemplate('videos/_components/fieldtypes/Video/input', $variables);
98 98
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 return $video;
134 134
             }
135 135
         } catch (\Exception $exception) {
136
-            Craft::info("Couldn't get video in field normalizeValue: " . $exception->getMessage(), __METHOD__);
136
+            Craft::info("Couldn't get video in field normalizeValue: ".$exception->getMessage(), __METHOD__);
137 137
         }
138 138
 
139 139
         return null;
Please login to merge, or discard this patch.
src/gateways/YouTube.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $options = [
268 268
             'base_uri' => $this->getApiUrl(),
269 269
             'headers' => [
270
-                'Authorization' => 'Bearer ' . $this->getOauthToken()->getToken()
270
+                'Authorization' => 'Bearer '.$this->getOauthToken()->getToken()
271 271
             ]
272 272
         ];
273 273
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
         $video = new Video;
605 605
         $video->raw = $data;
606 606
         $video->authorName = $data['snippet']['channelTitle'];
607
-        $video->authorUrl = 'http://youtube.com/channel/' . $data['snippet']['channelId'];
607
+        $video->authorUrl = 'http://youtube.com/channel/'.$data['snippet']['channelId'];
608 608
         $video->date = strtotime($data['snippet']['publishedAt']);
609 609
         $video->description = $data['snippet']['description'];
610 610
         $video->gatewayHandle = 'youtube';
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
         $video->id = $data['id'];
613 613
         $video->plays = $data['statistics']['viewCount'];
614 614
         $video->title = $data['snippet']['title'];
615
-        $video->url = 'http://youtu.be/' . $video->id;
615
+        $video->url = 'http://youtu.be/'.$video->id;
616 616
 
617 617
         // Video Duration
618 618
         $interval = new \DateInterval($data['contentDetails']['duration']);
619
-        $video->durationSeconds = (int)date_create('@0')->add($interval)->getTimestamp();
619
+        $video->durationSeconds = (int) date_create('@0')->add($interval)->getTimestamp();
620 620
         $video->duration8601 = $data['contentDetails']['duration'];
621 621
 
622 622
         // Thumbnails
Please login to merge, or discard this patch.
src/helpers/VideosHelper.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public static function getDuration($seconds): string
32 32
     {
33
-        $hours = (int)((int)$seconds / 3600);
33
+        $hours = (int) ((int) $seconds / 3600);
34 34
         $minutes = (($seconds / 60) % 60);
35 35
         $seconds %= 60;
36 36
 
37 37
         $hms = '';
38 38
 
39 39
         if ($hours > 0) {
40
-            $hms .= str_pad($hours, 2, '0', STR_PAD_LEFT) . ':';
40
+            $hms .= str_pad($hours, 2, '0', STR_PAD_LEFT).':';
41 41
         }
42 42
 
43
-        $hms .= str_pad($minutes, 2, '0', STR_PAD_LEFT) . ':';
43
+        $hms .= str_pad($minutes, 2, '0', STR_PAD_LEFT).':';
44 44
 
45 45
         $hms .= str_pad($seconds, 2, '0', STR_PAD_LEFT);
46 46
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public static function getDuration8601($seconds): string
58 58
     {
59
-        $hours = (int)((int)$seconds / 3600);
59
+        $hours = (int) ((int) $seconds / 3600);
60 60
         $minutes = (($seconds / 60) % 60);
61 61
         $seconds %= 60;
62 62
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $iso8601 .= sprintf('%dM', $minutes);
71 71
         }
72 72
 
73
-        return $iso8601 . sprintf('%dS', $seconds);
73
+        return $iso8601.sprintf('%dS', $seconds);
74 74
     }
75 75
 
76 76
     /**
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public static function getVideoThumbnail($gatewayHandle, $videoId, $size): ?string
90 90
     {
91
-        $baseDir = Craft::$app->getPath()->getRuntimePath() . DIRECTORY_SEPARATOR . 'videos' . DIRECTORY_SEPARATOR . 'thumbnails' . DIRECTORY_SEPARATOR . $gatewayHandle . DIRECTORY_SEPARATOR . $videoId;
92
-        $originalDir = $baseDir . DIRECTORY_SEPARATOR . 'original';
93
-        $dir = $baseDir . DIRECTORY_SEPARATOR . $size;
91
+        $baseDir = Craft::$app->getPath()->getRuntimePath().DIRECTORY_SEPARATOR.'videos'.DIRECTORY_SEPARATOR.'thumbnails'.DIRECTORY_SEPARATOR.$gatewayHandle.DIRECTORY_SEPARATOR.$videoId;
92
+        $originalDir = $baseDir.DIRECTORY_SEPARATOR.'original';
93
+        $dir = $baseDir.DIRECTORY_SEPARATOR.$size;
94 94
 
95 95
         $file = self::getThumbnailFile($dir);
96 96
 
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
                 try {
111 111
                     $video = Plugin::$plugin->getVideos()->getVideoById($gatewayHandle, $videoId);
112 112
                 } catch (ApiResponseException $apiResponseException) {
113
-                    Craft::info('Couldn’t get video thumbnail:' . "\r\n"
114
-                        . 'Message: ' . "\r\n" . $apiResponseException->getMessage() . "\r\n"
115
-                        . 'Trace: ' . "\r\n" . $apiResponseException->getTraceAsString(), __METHOD__);
113
+                    Craft::info('Couldn’t get video thumbnail:'."\r\n"
114
+                        . 'Message: '."\r\n".$apiResponseException->getMessage()."\r\n"
115
+                        . 'Trace: '."\r\n".$apiResponseException->getTraceAsString(), __METHOD__);
116 116
                     return null;
117 117
                 }
118 118
 
119 119
                 $url = $video->thumbnailSource;
120 120
 
121 121
                 $name = pathinfo($url, PATHINFO_BASENAME);
122
-                $originalPath = $originalDir . DIRECTORY_SEPARATOR . $name;
122
+                $originalPath = $originalDir.DIRECTORY_SEPARATOR.$name;
123 123
 
124 124
                 FileHelper::createDirectory($originalDir);
125 125
                 $client = new \GuzzleHttp\Client();
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
                     $ext = FileHelper::getExtensionByMimeType($mime);
137 137
 
138 138
                     if ($ext !== '' && $ext !== '0') {
139
-                        $name .= '.' . $ext;
140
-                        $targetPath = $originalDir . DIRECTORY_SEPARATOR . $name;
139
+                        $name .= '.'.$ext;
140
+                        $targetPath = $originalDir.DIRECTORY_SEPARATOR.$name;
141 141
 
142 142
                         rename($originalPath, $targetPath);
143 143
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             }
154 154
 
155 155
             // Generate the thumb
156
-            $path = $dir . DIRECTORY_SEPARATOR . $name;
156
+            $path = $dir.DIRECTORY_SEPARATOR.$name;
157 157
             FileHelper::createDirectory($dir);
158 158
             Craft::$app->getImages()->loadImage($originalPath, false, $size)
159 159
                 ->scaleToFit($size, $size)
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $name = pathinfo($file, PATHINFO_BASENAME);
163 163
         }
164 164
 
165
-        return Craft::$app->getAssetManager()->getPublishedUrl($dir, true) . sprintf('/%s', $name);
165
+        return Craft::$app->getAssetManager()->getPublishedUrl($dir, true).sprintf('/%s', $name);
166 166
     }
167 167
 
168 168
     /**
Please login to merge, or discard this patch.