@@ -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 | /** |
@@ -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) |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function fetch(string $pathOrUrl, callable $callback = null, string $cacheKeySuffix = '') |
52 | 52 | { |
53 | - $pathOrUrl = (string)Craft::parseEnv($pathOrUrl); |
|
53 | + $pathOrUrl = (string) Craft::parseEnv($pathOrUrl); |
|
54 | 54 | // Create the dependency tags |
55 | 55 | $dependency = new TagDependency([ |
56 | 56 | 'tags' => [ |
57 | - self::CACHE_TAG . $cacheKeySuffix, |
|
58 | - self::CACHE_TAG . $cacheKeySuffix . $pathOrUrl, |
|
57 | + self::CACHE_TAG.$cacheKeySuffix, |
|
58 | + self::CACHE_TAG.$cacheKeySuffix.$pathOrUrl, |
|
59 | 59 | ], |
60 | 60 | ]); |
61 | 61 | // If this is a file path such as for the `manifest.json`, add a FileDependency so it's cache bust if the file changes |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | // Get the result from the cache, or parse the file |
77 | 77 | $cache = Craft::$app->getCache(); |
78 | 78 | return $cache->getOrSet( |
79 | - self::CACHE_KEY . $cacheKeySuffix . $pathOrUrl, |
|
80 | - function () use ($pathOrUrl, $callback) { |
|
79 | + self::CACHE_KEY.$cacheKeySuffix.$pathOrUrl, |
|
80 | + function() use ($pathOrUrl, $callback) { |
|
81 | 81 | $contents = null; |
82 | 82 | if (UrlHelper::isAbsoluteUrl($pathOrUrl)) { |
83 | 83 | $response = self::fetchResponse($pathOrUrl); |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public static function createUrl(string $url, string $path): string |
139 | 139 | { |
140 | - $url = (string)Craft::parseEnv($url); |
|
141 | - return rtrim($url, '/') . '/' . trim($path, '/'); |
|
140 | + $url = (string) Craft::parseEnv($url); |
|
141 | + return rtrim($url, '/').'/'.trim($path, '/'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -46,7 +46,7 @@ |
||
46 | 46 | public function init(): void |
47 | 47 | { |
48 | 48 | // See if the $pluginDevServerEnvVar env var exists, and if not, don't run off of the dev server |
49 | - $useDevServer = (bool)App::env($this->pluginDevServerEnvVar); |
|
49 | + $useDevServer = (bool) App::env($this->pluginDevServerEnvVar); |
|
50 | 50 | if ($useDevServer === false) { |
51 | 51 | $this->useDevServer = false; |
52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @var array|string The JavaScript entry from the manifest.json to inject on Twig error pages |
63 | 63 | * This can be a string or an array of strings |
64 | 64 | */ |
65 | - public array|string $errorEntry = ''; |
|
65 | + public array | string $errorEntry = ''; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @var string String to be appended to the cache key |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return string|array|null |
195 | 195 | */ |
196 | - public function fetch(string $pathOrUrl, callable $callback = null): string|array|null |
|
196 | + public function fetch(string $pathOrUrl, callable $callback = null): string | array | null |
|
197 | 197 | { |
198 | 198 | return FileHelper::fetch($pathOrUrl, $callback, $this->cacheKeySuffix); |
199 | 199 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
219 | 219 | $script = str_replace( |
220 | 220 | 'http://localhost:3000/', |
221 | - rtrim($this->devServerPublic, '/') . '/', |
|
221 | + rtrim($this->devServerPublic, '/').'/', |
|
222 | 222 | $script |
223 | 223 | ); |
224 | 224 | $view->registerScript( |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $view->registerJsFile( |
238 | 238 | $url, |
239 | 239 | array_merge(['type' => 'module'], $scriptTagAttrs), |
240 | - md5($url . JsonHelper::encode($scriptTagAttrs)) |
|
240 | + md5($url.JsonHelper::encode($scriptTagAttrs)) |
|
241 | 241 | ); |
242 | 242 | } |
243 | 243 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | public function invalidateCaches(): void |
380 | 380 | { |
381 | 381 | $cache = Craft::$app->getCache(); |
382 | - TagDependency::invalidate($cache, FileHelper::CACHE_TAG . $this->cacheKeySuffix); |
|
382 | + TagDependency::invalidate($cache, FileHelper::CACHE_TAG.$this->cacheKeySuffix); |
|
383 | 383 | Craft::info('All Vite caches cleared', __METHOD__); |
384 | 384 | } |
385 | 385 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | // Replace the hard-coded dev server URL with whatever they have theirs set to |
423 | 423 | $script = str_replace( |
424 | 424 | 'http://localhost:3000/', |
425 | - rtrim($this->devServerPublic, '/') . '/', |
|
425 | + rtrim($this->devServerPublic, '/').'/', |
|
426 | 426 | $script |
427 | 427 | ); |
428 | 428 | $lines[] = HtmlHelper::script( |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $view->registerJsFile( |
506 | 506 | $url, |
507 | 507 | $tag['options'], |
508 | - md5($url . JsonHelper::encode($tag['options'])) |
|
508 | + md5($url.JsonHelper::encode($tag['options'])) |
|
509 | 509 | ); |
510 | 510 | break; |
511 | 511 | case 'css': |