@@ -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 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 213 | 213 | $script = str_replace( |
| 214 | 214 | 'http://localhost:3000/', |
| 215 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 215 | + rtrim($this->devServerPublic, '/').'/', |
|
| 216 | 216 | $script |
| 217 | 217 | ); |
| 218 | 218 | $view->registerScript( |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $view->registerJsFile( |
| 232 | 232 | $url, |
| 233 | 233 | array_merge(['type' => 'module'], $scriptTagAttrs), |
| 234 | - md5($url . JsonHelper::encode($scriptTagAttrs)) |
|
| 234 | + md5($url.JsonHelper::encode($scriptTagAttrs)) |
|
| 235 | 235 | ); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * |
| 302 | 302 | * @return string |
| 303 | 303 | */ |
| 304 | - public function asset(string $path, bool $public=false): string |
|
| 304 | + public function asset(string $path, bool $public = false): string |
|
| 305 | 305 | { |
| 306 | 306 | if ($this->devServerRunning()) { |
| 307 | 307 | return $this->devServerAsset($path); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | public function invalidateCaches() |
| 370 | 370 | { |
| 371 | 371 | $cache = Craft::$app->getCache(); |
| 372 | - TagDependency::invalidate($cache, FileHelper::CACHE_TAG . $this->cacheKeySuffix); |
|
| 372 | + TagDependency::invalidate($cache, FileHelper::CACHE_TAG.$this->cacheKeySuffix); |
|
| 373 | 373 | Craft::info('All Vite caches cleared', __METHOD__); |
| 374 | 374 | } |
| 375 | 375 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 413 | 413 | $script = str_replace( |
| 414 | 414 | 'http://localhost:3000/', |
| 415 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 415 | + rtrim($this->devServerPublic, '/').'/', |
|
| 416 | 416 | $script |
| 417 | 417 | ); |
| 418 | 418 | $lines[] = HtmlHelper::script( |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $view->registerJsFile( |
| 496 | 496 | $url, |
| 497 | 497 | $tag['options'], |
| 498 | - md5($url . JsonHelper::encode($tag['options'])) |
|
| 498 | + md5($url.JsonHelper::encode($tag['options'])) |
|
| 499 | 499 | ); |
| 500 | 500 | break; |
| 501 | 501 | case 'css': |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | * |
| 95 | 95 | * @return Markup |
| 96 | 96 | */ |
| 97 | - public function asset(string $path, bool $public=false): Markup |
|
| 97 | + public function asset(string $path, bool $public = false): Markup |
|
| 98 | 98 | { |
| 99 | 99 | return Template::raw( |
| 100 | 100 | $this->viteService->asset($path, $public) |