@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Event::on( |
108 | 108 | View::class, |
109 | 109 | View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE, |
110 | - function (TemplateEvent $event) { |
|
110 | + function(TemplateEvent $event) { |
|
111 | 111 | self::$templateName = $event->template; |
112 | 112 | } |
113 | 113 | ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | Event::on( |
116 | 116 | CraftVariable::class, |
117 | 117 | CraftVariable::EVENT_INIT, |
118 | - function (Event $event) { |
|
118 | + function(Event $event) { |
|
119 | 119 | /** @var CraftVariable $variable */ |
120 | 120 | $variable = $event->sender; |
121 | 121 | $variable->set('twigpack', ManifestVariable::class); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | Event::on( |
126 | 126 | TemplateCaches::class, |
127 | 127 | TemplateCaches::EVENT_AFTER_DELETE_CACHES, |
128 | - function (DeleteTemplateCachesEvent $event) { |
|
128 | + function(DeleteTemplateCachesEvent $event) { |
|
129 | 129 | // Invalidate the caches when template caches are deleted |
130 | 130 | $this->clearAllCaches(); |
131 | 131 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | Event::on( |
135 | 135 | Plugins::class, |
136 | 136 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
137 | - function (PluginEvent $event) { |
|
137 | + function(PluginEvent $event) { |
|
138 | 138 | if ($event->plugin === $this) { |
139 | 139 | // Invalidate our caches after we've been installed |
140 | 140 | $this->clearAllCaches(); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | Event::on( |
146 | 146 | ClearCaches::class, |
147 | 147 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
148 | - function (RegisterCacheOptionsEvent $event) { |
|
148 | + function(RegisterCacheOptionsEvent $event) { |
|
149 | 149 | Craft::debug( |
150 | 150 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', |
151 | 151 | __METHOD__ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // delay attaching event handler to the view component after it is fully configured |
161 | 161 | $app = Craft::$app; |
162 | 162 | if ($app->getConfig()->getGeneral()->devMode) { |
163 | - $app->on(Application::EVENT_BEFORE_REQUEST, function () use ($app) { |
|
163 | + $app->on(Application::EVENT_BEFORE_REQUEST, function() use ($app) { |
|
164 | 164 | $app->getView()->on(View::EVENT_END_BODY, [$this, 'injectErrorEntry']); |
165 | 165 | }); |
166 | 166 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | 'errorEntry' => '', |
33 | 33 | // String to be appended to the cache key |
34 | 34 | 'cacheKeySuffix' => '', |
35 | - // Manifest file names |
|
35 | + // Manifest file names |
|
36 | 36 | 'manifest' => [ |
37 | 37 | 'legacy' => 'manifest-legacy.json', |
38 | 38 | 'modern' => 'manifest.json', |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | $dirPrefix = CRAFT_TEMPLATES_PATH; |
151 | 151 | } |
152 | 152 | $name = strstr($name, $dirPrefix); |
153 | - $name = (string)str_replace($dirPrefix, '', $name); |
|
153 | + $name = (string) str_replace($dirPrefix, '', $name); |
|
154 | 154 | $path = self::combinePaths( |
155 | 155 | $config['localFiles']['basePath'], |
156 | 156 | $config['localFiles']['criticalPrefix'], |
157 | 157 | $name |
158 | - ) . $config['localFiles']['criticalSuffix']; |
|
158 | + ).$config['localFiles']['criticalSuffix']; |
|
159 | 159 | |
160 | 160 | return self::getCssInlineTags($path, $attributes); |
161 | 161 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $dependency = new TagDependency([ |
572 | 572 | 'tags' => [ |
573 | 573 | self::CACHE_TAG, |
574 | - self::CACHE_TAG . $path, |
|
574 | + self::CACHE_TAG.$path, |
|
575 | 575 | ], |
576 | 576 | ]); |
577 | 577 | // If this is a file path such as for the `manifest.json`, add a FileDependency so it's cache bust if the file changes |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | $settings = Twigpack::$plugin->getSettings(); |
595 | 595 | $cacheKeySuffix = $settings->cacheKeySuffix ?? ''; |
596 | 596 | $file = $cache->getOrSet( |
597 | - self::CACHE_KEY . $cacheKeySuffix . $path, |
|
598 | - function () use ($path, $callback) { |
|
597 | + self::CACHE_KEY.$cacheKeySuffix.$path, |
|
598 | + function() use ($path, $callback) { |
|
599 | 599 | $result = null; |
600 | 600 | $contents = null; |
601 | 601 | if (UrlHelper::isAbsoluteUrl($path)) { |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | protected static function combinePaths(string ...$paths): string |
674 | 674 | { |
675 | 675 | $last_key = count($paths) - 1; |
676 | - array_walk($paths, function (&$val, $key) use ($last_key) { |
|
676 | + array_walk($paths, function(&$val, $key) use ($last_key) { |
|
677 | 677 | switch ($key) { |
678 | 678 | case 0: |
679 | 679 | $val = rtrim($val, '/ '); |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | ]); |
737 | 737 | break; |
738 | 738 | case 'header': |
739 | - Craft::$app->getResponse()->getHeaders()->add($cspHeader, $cspValue . ';'); |
|
739 | + Craft::$app->getResponse()->getHeaders()->add($cspHeader, $cspValue.';'); |
|
740 | 740 | break; |
741 | 741 | default: |
742 | 742 | break; |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | { |
784 | 784 | $json = JsonHelper::decodeIfJson($string); |
785 | 785 | if (is_string($json)) { |
786 | - Craft::error('Error decoding JSON file: ' . $json, __METHOD__); |
|
786 | + Craft::error('Error decoding JSON file: '.$json, __METHOD__); |
|
787 | 787 | $json = null; |
788 | 788 | } |
789 | 789 |