Passed
Push — develop ( 0538bf...b9d88f )
by Andrew
04:03
created
src/services/ViteService.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $tags = array_merge($legacyPolyfillTags, $tags);
191 191
             $this->legacyPolyfillIncluded = true;
192 192
         }
193
-        foreach($tags as $tag) {
193
+        foreach ($tags as $tag) {
194 194
             if (!empty($tag)) {
195 195
                 switch ($tag['type']) {
196 196
                     case 'file':
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $view->registerJsFile(
249 249
             $url,
250 250
             array_merge(['type' => 'module'], $scriptTagAttrs),
251
-            md5($url . JsonHelper::encode($scriptTagAttrs))
251
+            md5($url.JsonHelper::encode($scriptTagAttrs))
252 252
         );
253 253
     }
254 254
 
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
             $tags = array_merge($legacyPolyfillTags, $tags);
275 275
             $this->legacyPolyfillIncluded = true;
276 276
         }
277
-        foreach($tags as $tag) {
277
+        foreach ($tags as $tag) {
278 278
             if (!empty($tag)) {
279 279
                 switch ($tag['type']) {
280 280
                     case 'file':
281 281
                         $view->registerJsFile(
282 282
                             $tag['url'],
283 283
                             $tag['options'],
284
-                            md5($tag['url'] . JsonHelper::encode($tag['options']))
284
+                            md5($tag['url'].JsonHelper::encode($tag['options']))
285 285
                         );
286 286
                         break;
287 287
                     case 'css':
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function fetch(string $pathOrUrl, callable $callback = null)
311 311
     {
312
-        $pathOrUrl = (string)Craft::parseEnv($pathOrUrl);
312
+        $pathOrUrl = (string) Craft::parseEnv($pathOrUrl);
313 313
         // Create the dependency tags
314 314
         $dependency = new TagDependency([
315 315
             'tags' => [
316
-                self::CACHE_TAG . $this->cacheKeySuffix,
317
-                self::CACHE_TAG . $this->cacheKeySuffix . $pathOrUrl,
316
+                self::CACHE_TAG.$this->cacheKeySuffix,
317
+                self::CACHE_TAG.$this->cacheKeySuffix.$pathOrUrl,
318 318
             ],
319 319
         ]);
320 320
         // If this is a file path such as for the `manifest.json`, add a FileDependency so it's cache bust if the file changes
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
         // Get the result from the cache, or parse the file
336 336
         $cache = Craft::$app->getCache();
337 337
         return $cache->getOrSet(
338
-            self::CACHE_KEY . $this->cacheKeySuffix . $pathOrUrl,
339
-            function () use ($pathOrUrl, $callback) {
338
+            self::CACHE_KEY.$this->cacheKeySuffix.$pathOrUrl,
339
+            function() use ($pathOrUrl, $callback) {
340 340
                 $contents = null;
341 341
                 $result = null;
342 342
                 if (UrlHelper::isAbsoluteUrl($pathOrUrl)) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     public function invalidateCaches()
406 406
     {
407 407
         $cache = Craft::$app->getCache();
408
-        TagDependency::invalidate($cache, self::CACHE_TAG . $this->cacheKeySuffix);
408
+        TagDependency::invalidate($cache, self::CACHE_TAG.$this->cacheKeySuffix);
409 409
         Craft::info('All Vite caches cleared', __METHOD__);
410 410
     }
411 411
 
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
     {
499 499
         $tags = [];
500 500
         // Grab the manifest
501
-        $pathOrUrl = (string)Craft::parseEnv($this->manifestPath);
501
+        $pathOrUrl = (string) Craft::parseEnv($this->manifestPath);
502 502
         $manifest = $this->fetch($pathOrUrl, [JsonHelper::class, 'decodeIfJson']);
503 503
         // If no manifest file is found, bail
504 504
         if ($manifest === null) {
505
-            Craft::error('Manifest not found at ' . $this->manifestPath, __METHOD__);
505
+            Craft::error('Manifest not found at '.$this->manifestPath, __METHOD__);
506 506
 
507 507
             return [];
508 508
         }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      */
597 597
     protected function createUrl(string $url, string $path): string
598 598
     {
599
-        $url = (string)Craft::parseEnv($url);
600
-        return rtrim($url, '/') . '/' . trim($path, '/');
599
+        $url = (string) Craft::parseEnv($url);
600
+        return rtrim($url, '/').'/'.trim($path, '/');
601 601
     }
602 602
 }
Please login to merge, or discard this patch.