@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $tags = array_merge($legacyPolyfillTags, $tags); |
| 178 | 178 | $this->legacyPolyfillIncluded = true; |
| 179 | 179 | } |
| 180 | - foreach(array_merge($tags, $legacyTags) as $tag) { |
|
| 180 | + foreach (array_merge($tags, $legacyTags) as $tag) { |
|
| 181 | 181 | if (!empty($tag)) { |
| 182 | 182 | $url = UrlHelper::createUrl($this->serverPublic, $tag['url']); |
| 183 | 183 | switch ($tag['type']) { |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $view->registerJsFile( |
| 237 | 237 | $url, |
| 238 | 238 | array_merge(['type' => 'module'], $scriptTagAttrs), |
| 239 | - md5($url . JsonHelper::encode($scriptTagAttrs)) |
|
| 239 | + md5($url.JsonHelper::encode($scriptTagAttrs)) |
|
| 240 | 240 | ); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $tags = array_merge($legacyPolyfillTags, $tags); |
| 265 | 265 | $this->legacyPolyfillIncluded = true; |
| 266 | 266 | } |
| 267 | - foreach(array_merge($tags, $legacyTags) as $tag) { |
|
| 267 | + foreach (array_merge($tags, $legacyTags) as $tag) { |
|
| 268 | 268 | if (!empty($tag)) { |
| 269 | 269 | $url = UrlHelper::createUrl($this->serverPublic, $tag['url']); |
| 270 | 270 | switch ($tag['type']) { |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $view->registerJsFile( |
| 273 | 273 | $url, |
| 274 | 274 | $tag['options'], |
| 275 | - md5($url . JsonHelper::encode($tag['options'])) |
|
| 275 | + md5($url.JsonHelper::encode($tag['options'])) |
|
| 276 | 276 | ); |
| 277 | 277 | break; |
| 278 | 278 | case 'css': |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | public function invalidateCaches() |
| 331 | 331 | { |
| 332 | 332 | $cache = Craft::$app->getCache(); |
| 333 | - TagDependency::invalidate($cache, FileHelper::CACHE_TAG . $this->cacheKeySuffix); |
|
| 333 | + TagDependency::invalidate($cache, FileHelper::CACHE_TAG.$this->cacheKeySuffix); |
|
| 334 | 334 | Craft::info('All Vite caches cleared', __METHOD__); |
| 335 | 335 | } |
| 336 | 336 | |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function fetch(string $pathOrUrl, callable $callback = null, string $cacheKeySuffix = '') |
| 54 | 54 | { |
| 55 | - $pathOrUrl = (string)Craft::parseEnv($pathOrUrl); |
|
| 55 | + $pathOrUrl = (string) Craft::parseEnv($pathOrUrl); |
|
| 56 | 56 | // Create the dependency tags |
| 57 | 57 | $dependency = new TagDependency([ |
| 58 | 58 | 'tags' => [ |
| 59 | - self::CACHE_TAG . $cacheKeySuffix, |
|
| 60 | - self::CACHE_TAG . $cacheKeySuffix . $pathOrUrl, |
|
| 59 | + self::CACHE_TAG.$cacheKeySuffix, |
|
| 60 | + self::CACHE_TAG.$cacheKeySuffix.$pathOrUrl, |
|
| 61 | 61 | ], |
| 62 | 62 | ]); |
| 63 | 63 | // If this is a file path such as for the `manifest.json`, add a FileDependency so it's cache bust if the file changes |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | // Get the result from the cache, or parse the file |
| 79 | 79 | $cache = Craft::$app->getCache(); |
| 80 | 80 | return $cache->getOrSet( |
| 81 | - self::CACHE_KEY . $cacheKeySuffix . $pathOrUrl, |
|
| 82 | - function () use ($pathOrUrl, $callback) { |
|
| 81 | + self::CACHE_KEY.$cacheKeySuffix.$pathOrUrl, |
|
| 82 | + function() use ($pathOrUrl, $callback) { |
|
| 83 | 83 | $contents = null; |
| 84 | 84 | $result = null; |
| 85 | 85 | if (UrlHelper::isAbsoluteUrl($pathOrUrl)) { |
@@ -45,14 +45,14 @@ |
||
| 45 | 45 | public static function fetchManifest(string $manifestPath) |
| 46 | 46 | { |
| 47 | 47 | // Grab the manifest |
| 48 | - $pathOrUrl = (string)Craft::parseEnv($manifestPath); |
|
| 48 | + $pathOrUrl = (string) Craft::parseEnv($manifestPath); |
|
| 49 | 49 | $manifest = FileHelper::fetch($pathOrUrl, [JsonHelper::class, 'decodeIfJson']); |
| 50 | 50 | // If no manifest file is found, log it |
| 51 | 51 | if ($manifest === null) { |
| 52 | - Craft::error('Manifest not found at ' . $manifestPath, __METHOD__); |
|
| 52 | + Craft::error('Manifest not found at '.$manifestPath, __METHOD__); |
|
| 53 | 53 | } |
| 54 | 54 | // Ensure we're dealing with an array |
| 55 | - self::$manifest = (array)$manifest; |
|
| 55 | + self::$manifest = (array) $manifest; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public static function createUrl(string $url, string $path): string |
| 31 | 31 | { |
| 32 | - $url = (string)Craft::parseEnv($url); |
|
| 33 | - return rtrim($url, '/') . '/' . trim($path, '/'); |
|
| 32 | + $url = (string) Craft::parseEnv($url); |
|
| 33 | + return rtrim($url, '/').'/'.trim($path, '/'); |
|
| 34 | 34 | } |
| 35 | 35 | } |