@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public static function fetch(string $pathOrUrl, callable $callback = null, string $cacheKeySuffix = '') |
| 56 | 56 | { |
| 57 | - $pathOrUrl = (string)Craft::parseEnv($pathOrUrl); |
|
| 57 | + $pathOrUrl = (string) Craft::parseEnv($pathOrUrl); |
|
| 58 | 58 | // Create the dependency tags |
| 59 | 59 | $dependency = new TagDependency([ |
| 60 | 60 | 'tags' => [ |
| 61 | - self::CACHE_TAG . $cacheKeySuffix, |
|
| 62 | - self::CACHE_TAG . $cacheKeySuffix . $pathOrUrl, |
|
| 61 | + self::CACHE_TAG.$cacheKeySuffix, |
|
| 62 | + self::CACHE_TAG.$cacheKeySuffix.$pathOrUrl, |
|
| 63 | 63 | ], |
| 64 | 64 | ]); |
| 65 | 65 | // If this is a file path such as for the `manifest.json`, add a FileDependency so it's cache bust if the file changes |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | // Get the result from the cache, or parse the file |
| 81 | 81 | $cache = Craft::$app->getCache(); |
| 82 | 82 | return $cache->getOrSet( |
| 83 | - self::CACHE_KEY . $cacheKeySuffix . $pathOrUrl, |
|
| 84 | - function () use ($pathOrUrl, $callback) { |
|
| 83 | + self::CACHE_KEY.$cacheKeySuffix.$pathOrUrl, |
|
| 84 | + function() use ($pathOrUrl, $callback) { |
|
| 85 | 85 | $contents = null; |
| 86 | 86 | $result = null; |
| 87 | 87 | if (UrlHelper::isAbsoluteUrl($pathOrUrl)) { |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public static function createUrl(string $url, string $path): string |
| 135 | 135 | { |
| 136 | - $url = (string)Craft::parseEnv($url); |
|
| 137 | - return rtrim($url, '/') . '/' . trim($path, '/'); |
|
| 136 | + $url = (string) Craft::parseEnv($url); |
|
| 137 | + return rtrim($url, '/').'/'.trim($path, '/'); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | public static function fetchManifest(string $manifestPath) |
| 51 | 51 | { |
| 52 | 52 | // Grab the manifest |
| 53 | - $pathOrUrl = (string)Craft::parseEnv($manifestPath); |
|
| 53 | + $pathOrUrl = (string) Craft::parseEnv($manifestPath); |
|
| 54 | 54 | $manifest = FileHelper::fetch($pathOrUrl, [JsonHelper::class, 'decodeIfJson']); |
| 55 | 55 | // If no manifest file is found, log it |
| 56 | 56 | if ($manifest === null) { |
| 57 | - Craft::error('Manifest not found at ' . $manifestPath, __METHOD__); |
|
| 57 | + Craft::error('Manifest not found at '.$manifestPath, __METHOD__); |
|
| 58 | 58 | } |
| 59 | 59 | // Ensure we're dealing with an array |
| 60 | - self::$manifest = (array)$manifest; |
|
| 60 | + self::$manifest = (array) $manifest; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $filename = implode('.', $filenameParts); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - return (string)$filename; |
|
| 267 | + return (string) $filename; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 203 | 203 | $script = str_replace( |
| 204 | 204 | 'http://localhost:3000/', |
| 205 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 205 | + rtrim($this->devServerPublic, '/').'/', |
|
| 206 | 206 | $script |
| 207 | 207 | ); |
| 208 | 208 | $view->registerScript( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $view->registerJsFile( |
| 222 | 222 | $url, |
| 223 | 223 | array_merge(['type' => 'module'], $scriptTagAttrs), |
| 224 | - md5($url . JsonHelper::encode($scriptTagAttrs)) |
|
| 224 | + md5($url.JsonHelper::encode($scriptTagAttrs)) |
|
| 225 | 225 | ); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $view->registerJsFile( |
| 288 | 288 | $url, |
| 289 | 289 | $tag['options'], |
| 290 | - md5($url . JsonHelper::encode($tag['options'])) |
|
| 290 | + md5($url.JsonHelper::encode($tag['options'])) |
|
| 291 | 291 | ); |
| 292 | 292 | break; |
| 293 | 293 | case 'css': |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | public function invalidateCaches() |
| 388 | 388 | { |
| 389 | 389 | $cache = Craft::$app->getCache(); |
| 390 | - TagDependency::invalidate($cache, FileHelper::CACHE_TAG . $this->cacheKeySuffix); |
|
| 390 | + TagDependency::invalidate($cache, FileHelper::CACHE_TAG.$this->cacheKeySuffix); |
|
| 391 | 391 | Craft::info('All Vite caches cleared', __METHOD__); |
| 392 | 392 | } |
| 393 | 393 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 470 | 470 | $script = str_replace( |
| 471 | 471 | 'http://localhost:3000/', |
| 472 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 472 | + rtrim($this->devServerPublic, '/').'/', |
|
| 473 | 473 | $script |
| 474 | 474 | ); |
| 475 | 475 | $lines[] = HtmlHelper::script( |