@@ -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', |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | $dirPrefix = CRAFT_TEMPLATES_PATH; |
146 | 146 | } |
147 | 147 | $name = strstr($name, $dirPrefix); |
148 | - $name = (string)str_replace($dirPrefix, '', $name); |
|
148 | + $name = (string) str_replace($dirPrefix, '', $name); |
|
149 | 149 | $path = self::combinePaths( |
150 | 150 | $config['localFiles']['basePath'], |
151 | 151 | $config['localFiles']['criticalPrefix'], |
152 | 152 | $name |
153 | - ) . $config['localFiles']['criticalSuffix']; |
|
153 | + ).$config['localFiles']['criticalSuffix']; |
|
154 | 154 | |
155 | 155 | return self::getCssInlineTags($path, $attributes); |
156 | 156 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $dependency = new TagDependency([ |
558 | 558 | 'tags' => [ |
559 | 559 | self::CACHE_TAG, |
560 | - self::CACHE_TAG . $path, |
|
560 | + self::CACHE_TAG.$path, |
|
561 | 561 | ], |
562 | 562 | ]); |
563 | 563 | // Set the cache duration based on devMode |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | $settings = Twigpack::$plugin->getSettings(); |
574 | 574 | $cacheKeySuffix = $settings->cacheKeySuffix ?? ''; |
575 | 575 | $file = $cache->getOrSet( |
576 | - self::CACHE_KEY . $cacheKeySuffix . $path, |
|
577 | - function () use ($path, $callback) { |
|
576 | + self::CACHE_KEY.$cacheKeySuffix.$path, |
|
577 | + function() use ($path, $callback) { |
|
578 | 578 | $result = null; |
579 | 579 | $contents = null; |
580 | 580 | if (UrlHelper::isAbsoluteUrl($path)) { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | protected static function combinePaths(string ...$paths): string |
642 | 642 | { |
643 | 643 | $last_key = count($paths) - 1; |
644 | - array_walk($paths, function (&$val, $key) use ($last_key) { |
|
644 | + array_walk($paths, function(&$val, $key) use ($last_key) { |
|
645 | 645 | switch ($key) { |
646 | 646 | case 0: |
647 | 647 | $val = rtrim($val, '/ '); |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | $cspNonceType = self::getCspNonceType(); |
696 | 696 | if ($cspNonceType) { |
697 | 697 | $cspValue = "{$cspDirective} 'nonce-$nonce'"; |
698 | - foreach(self::CSP_HEADERS as $cspHeader) { |
|
698 | + foreach (self::CSP_HEADERS as $cspHeader) { |
|
699 | 699 | switch ($cspNonceType) { |
700 | 700 | case 'tag': |
701 | 701 | Craft::$app->getView()->registerMetaTag([ |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | ]); |
705 | 705 | break; |
706 | 706 | case 'header': |
707 | - Craft::$app->getResponse()->getHeaders()->add($cspHeader, $cspValue . ';'); |
|
707 | + Craft::$app->getResponse()->getHeaders()->add($cspHeader, $cspValue.';'); |
|
708 | 708 | break; |
709 | 709 | default: |
710 | 710 | break; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | { |
751 | 751 | $json = JsonHelper::decodeIfJson($string); |
752 | 752 | if (is_string($json)) { |
753 | - Craft::error('Error decoding JSON file: ' . $json, __METHOD__); |
|
753 | + Craft::error('Error decoding JSON file: '.$json, __METHOD__); |
|
754 | 754 | $json = null; |
755 | 755 | } |
756 | 756 |