@@ -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 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 166 | 166 | $script = str_replace( |
| 167 | 167 | 'http://localhost:3000/', |
| 168 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 168 | + rtrim($this->devServerPublic, '/').'/', |
|
| 169 | 169 | $script |
| 170 | 170 | ); |
| 171 | 171 | $lines[] = HtmlHelper::script( |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
| 271 | 271 | $script = str_replace( |
| 272 | 272 | 'http://localhost:3000/', |
| 273 | - rtrim($this->devServerPublic, '/') . '/', |
|
| 273 | + rtrim($this->devServerPublic, '/').'/', |
|
| 274 | 274 | $script |
| 275 | 275 | ); |
| 276 | 276 | $view->registerScript( |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $view->registerJsFile( |
| 290 | 290 | $url, |
| 291 | 291 | array_merge(['type' => 'module'], $scriptTagAttrs), |
| 292 | - md5($url . JsonHelper::encode($scriptTagAttrs)) |
|
| 292 | + md5($url.JsonHelper::encode($scriptTagAttrs)) |
|
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | // Get just the file name |
| 381 | 381 | $assetKeyParts = explode('/', $path); |
| 382 | 382 | $assetKey = end($assetKeyParts); |
| 383 | - foreach($assets as $key => $value) { |
|
| 383 | + foreach ($assets as $key => $value) { |
|
| 384 | 384 | if ($key === $assetKey) { |
| 385 | 385 | return FileHelper::createUrl($this->serverPublic, $value); |
| 386 | 386 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | public function invalidateCaches() |
| 432 | 432 | { |
| 433 | 433 | $cache = Craft::$app->getCache(); |
| 434 | - TagDependency::invalidate($cache, FileHelper::CACHE_TAG . $this->cacheKeySuffix); |
|
| 434 | + TagDependency::invalidate($cache, FileHelper::CACHE_TAG.$this->cacheKeySuffix); |
|
| 435 | 435 | Craft::info('All Vite caches cleared', __METHOD__); |
| 436 | 436 | } |
| 437 | 437 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $view->registerJsFile( |
| 530 | 530 | $url, |
| 531 | 531 | $tag['options'], |
| 532 | - md5($url . JsonHelper::encode($tag['options'])) |
|
| 532 | + md5($url.JsonHelper::encode($tag['options'])) |
|
| 533 | 533 | ); |
| 534 | 534 | break; |
| 535 | 535 | case 'css': |
@@ -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 | /** |