@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @inheritdoc |
| 54 | 54 | */ |
| 55 | - public function create($config = [], $add = true): MetaLink |
|
| 55 | + public function create($config = [ ], $add = true): MetaLink |
|
| 56 | 56 | { |
| 57 | 57 | $metaItem = MetaLink::create($config); |
| 58 | 58 | if ($add && !empty($metaItem)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function add($metaItem, string $handle = self::GENERAL_HANDLE) |
| 69 | 69 | { |
| 70 | - $key = MetaLinkContainer::CONTAINER_TYPE.$handle; |
|
| 70 | + $key = MetaLinkContainer::CONTAINER_TYPE . $handle; |
|
| 71 | 71 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
| 72 | 72 | |
| 73 | 73 | /** @var MetaLink $metaItem */ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function container(string $handle = self::GENERAL_HANDLE) |
| 93 | 93 | { |
| 94 | - $key = MetaLinkContainer::CONTAINER_TYPE.$handle; |
|
| 94 | + $key = MetaLinkContainer::CONTAINER_TYPE . $handle; |
|
| 95 | 95 | |
| 96 | 96 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
| 97 | 97 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @inheritdoc |
| 51 | 51 | */ |
| 52 | - public function create($config = [], $add = true): MetaTitle |
|
| 52 | + public function create($config = [ ], $add = true): MetaTitle |
|
| 53 | 53 | { |
| 54 | 54 | $metaItem = MetaTitle::create($config); |
| 55 | 55 | if ($add && !empty($metaItem)) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function add($metaItem, string $handle = self::GENERAL_HANDLE) |
| 66 | 66 | { |
| 67 | - $key = MetaTitleContainer::CONTAINER_TYPE.$handle; |
|
| 67 | + $key = MetaTitleContainer::CONTAINER_TYPE . $handle; |
|
| 68 | 68 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
| 69 | 69 | |
| 70 | 70 | /** @var MetaTitle $metaItem */ |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function container(string $handle = self::GENERAL_HANDLE) |
| 90 | 90 | { |
| 91 | - $key = MetaTitleContainer::CONTAINER_TYPE.$handle; |
|
| 91 | + $key = MetaTitleContainer::CONTAINER_TYPE . $handle; |
|
| 92 | 92 | |
| 93 | 93 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
| 94 | 94 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @inheritdoc |
| 51 | 51 | */ |
| 52 | - public function create($config = [], $add = true): MetaScript |
|
| 52 | + public function create($config = [ ], $add = true): MetaScript |
|
| 53 | 53 | { |
| 54 | 54 | $metaItem = MetaScript::create($config); |
| 55 | 55 | if ($add && !empty($metaItem)) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function add($metaItem, string $handle = self::GENERAL_HANDLE) |
| 66 | 66 | { |
| 67 | - $key = MetaScriptContainer::CONTAINER_TYPE.$handle; |
|
| 67 | + $key = MetaScriptContainer::CONTAINER_TYPE . $handle; |
|
| 68 | 68 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
| 69 | 69 | |
| 70 | 70 | /** @var MetaScript $metaItem */ |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function container(string $handle = self::GENERAL_HANDLE) |
| 90 | 90 | { |
| 91 | - $key = MetaScriptContainer::CONTAINER_TYPE.$handle; |
|
| 91 | + $key = MetaScriptContainer::CONTAINER_TYPE . $handle; |
|
| 92 | 92 | |
| 93 | 93 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
| 94 | 94 | } |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * @inheritdoc |
| 58 | 58 | */ |
| 59 | - public function create($config = [], $add = true): MetaTag |
|
| 59 | + public function create($config = [ ], $add = true): MetaTag |
|
| 60 | 60 | { |
| 61 | 61 | $type = self::DEFAULT_TYPE; |
| 62 | - if (!empty($config['type'])) { |
|
| 62 | + if (!empty($config[ 'type' ])) { |
|
| 63 | 63 | $type = ArrayHelper::remove($config, 'type'); |
| 64 | 64 | } |
| 65 | 65 | $metaItem = MetaTag::create($type, $config); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function add($metaItem, string $handle = self::GENERAL_HANDLE) |
| 77 | 77 | { |
| 78 | - $key = MetaTagContainer::CONTAINER_TYPE.$handle; |
|
| 78 | + $key = MetaTagContainer::CONTAINER_TYPE . $handle; |
|
| 79 | 79 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
| 80 | 80 | |
| 81 | 81 | /** @var MetaTag $metaItem */ |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function container(string $handle = self::GENERAL_HANDLE) |
| 101 | 101 | { |
| 102 | - $key = MetaTagContainer::CONTAINER_TYPE.$handle; |
|
| 102 | + $key = MetaTagContainer::CONTAINER_TYPE . $handle; |
|
| 103 | 103 | |
| 104 | 104 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
| 105 | 105 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | Event::on( |
| 94 | 94 | UrlManager::class, |
| 95 | 95 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 96 | - function (RegisterUrlRulesEvent $event) { |
|
| 96 | + function(RegisterUrlRulesEvent $event) { |
|
| 97 | 97 | Craft::debug( |
| 98 | 98 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 99 | 99 | __METHOD__ |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function frontendTemplateRouteRules(): array |
| 114 | 114 | { |
| 115 | - $rules = []; |
|
| 115 | + $rules = [ ]; |
|
| 116 | 116 | foreach ($this->frontendTemplateContainer->data as $frontendTemplate) { |
| 117 | 117 | if ($frontendTemplate->include) { |
| 118 | 118 | /** @var $frontendTemplate FrontendTemplate */ |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function renderTemplate(string $template, $params = []): string |
|
| 135 | + public function renderTemplate(string $template, $params = [ ]): string |
|
| 136 | 136 | { |
| 137 | 137 | $duration = Seomatic::$devMode |
| 138 | 138 | ? $this::DEVMODE_FRONTENDTEMPLATE_CACHE_DURATION |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | $cache = Craft::$app->getCache(); |
| 147 | 147 | $html = $cache->getOrSet( |
| 148 | 148 | $this::CACHE_KEY . $template, |
| 149 | - function () use ($template, $params) { |
|
| 149 | + function() use ($template, $params) { |
|
| 150 | 150 | Craft::info( |
| 151 | 151 | 'Frontend template cache miss: ' . $template, |
| 152 | 152 | __METHOD__ |
| 153 | 153 | ); |
| 154 | 154 | $html = ''; |
| 155 | - if (!empty($this->frontendTemplateContainer->data[$template])) { |
|
| 155 | + if (!empty($this->frontendTemplateContainer->data[ $template ])) { |
|
| 156 | 156 | /** @var $frontendTemplate FrontendTemplate */ |
| 157 | - $frontendTemplate = $this->frontendTemplateContainer->data[$template]; |
|
| 157 | + $frontendTemplate = $this->frontendTemplateContainer->data[ $template ]; |
|
| 158 | 158 | $html = $frontendTemplate->render($params); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | // Constants |
| 40 | 40 | // ========================================================================= |
| 41 | 41 | |
| 42 | - const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 42 | + const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 43 | 43 | |
| 44 | - const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE; |
|
| 44 | + const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE; |
|
| 45 | 45 | |
| 46 | 46 | const SEARCH_ENGINE_SUBMISSION_URLS = [ |
| 47 | 47 | 'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=', |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | Event::on( |
| 85 | 85 | UrlManager::class, |
| 86 | 86 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 87 | - function (RegisterUrlRulesEvent $event) { |
|
| 87 | + function(RegisterUrlRulesEvent $event) { |
|
| 88 | 88 | Craft::debug( |
| 89 | 89 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 90 | 90 | __METHOD__ |
@@ -103,18 +103,18 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function sitemapRouteRules(): array |
| 105 | 105 | { |
| 106 | - $rules = []; |
|
| 106 | + $rules = [ ]; |
|
| 107 | 107 | $groups = Craft::$app->getSites()->getAllGroups(); |
| 108 | - $groupId = $groups[0]->id; |
|
| 108 | + $groupId = $groups[ 0 ]->id; |
|
| 109 | 109 | $route = |
| 110 | 110 | Seomatic::$plugin->handle |
| 111 | 111 | .'/' |
| 112 | 112 | .'sitemap' |
| 113 | 113 | .'/' |
| 114 | 114 | .'sitemap-index'; |
| 115 | - $rules['sitemap.xml'] = [ |
|
| 115 | + $rules[ 'sitemap.xml' ] = [ |
|
| 116 | 116 | 'route' => $route, |
| 117 | - 'defaults' => ['groupId' => $groupId], |
|
| 117 | + 'defaults' => [ 'groupId' => $groupId ], |
|
| 118 | 118 | ]; |
| 119 | 119 | foreach ($this->sitemapTemplateContainer->data as $sitemapTemplate) { |
| 120 | 120 | /** @var $sitemapTemplate FrontendTemplate */ |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return string |
| 135 | 135 | */ |
| 136 | - public function renderTemplate(string $template, $params = []): string |
|
| 136 | + public function renderTemplate(string $template, $params = [ ]): string |
|
| 137 | 137 | { |
| 138 | 138 | $html = ''; |
| 139 | - if (!empty($this->sitemapTemplateContainer->data[$template])) { |
|
| 139 | + if (!empty($this->sitemapTemplateContainer->data[ $template ])) { |
|
| 140 | 140 | /** @var FrontendTemplate $sitemapTemplate */ |
| 141 | - $sitemapTemplate = $this->sitemapTemplateContainer->data[$template]; |
|
| 141 | + $sitemapTemplate = $this->sitemapTemplateContainer->data[ $template ]; |
|
| 142 | 142 | $html = $sitemapTemplate->render($params); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -156,22 +156,22 @@ discard block |
||
| 156 | 156 | foreach ($searchEngineUrls as &$url) { |
| 157 | 157 | $groups = Craft::$app->getSites()->getAllGroups(); |
| 158 | 158 | foreach ($groups as $group) { |
| 159 | - $siteId = $group->getSiteIds()[0]; |
|
| 159 | + $siteId = $group->getSiteIds()[ 0 ]; |
|
| 160 | 160 | $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId); |
| 161 | 161 | if (!empty($sitemapIndexUrl)) { |
| 162 | - $submissionUrl = $url.$sitemapIndexUrl; |
|
| 162 | + $submissionUrl = $url . $sitemapIndexUrl; |
|
| 163 | 163 | // create new guzzle client |
| 164 | - $guzzleClient = Craft::createGuzzleClient(['timeout' => 120, 'connect_timeout' => 120]); |
|
| 164 | + $guzzleClient = Craft::createGuzzleClient([ 'timeout' => 120, 'connect_timeout' => 120 ]); |
|
| 165 | 165 | // Submit the sitemap index to each search engine |
| 166 | 166 | try { |
| 167 | 167 | $guzzleClient->post($submissionUrl); |
| 168 | 168 | Craft::info( |
| 169 | - 'Sitemap index submitted to: '.$submissionUrl, |
|
| 169 | + 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 170 | 170 | __METHOD__ |
| 171 | 171 | ); |
| 172 | 172 | } catch (\Exception $e) { |
| 173 | 173 | Craft::error( |
| 174 | - 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 174 | + 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 175 | 175 | __METHOD__ |
| 176 | 176 | ); |
| 177 | 177 | } |
@@ -196,19 +196,19 @@ discard block |
||
| 196 | 196 | foreach ($searchEngineUrls as &$url) { |
| 197 | 197 | $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId); |
| 198 | 198 | if (!empty($sitemapUrl)) { |
| 199 | - $submissionUrl = $url.$sitemapUrl; |
|
| 199 | + $submissionUrl = $url . $sitemapUrl; |
|
| 200 | 200 | // create new guzzle client |
| 201 | - $guzzleClient = Craft::createGuzzleClient(['timeout' => 120, 'connect_timeout' => 120]); |
|
| 201 | + $guzzleClient = Craft::createGuzzleClient([ 'timeout' => 120, 'connect_timeout' => 120 ]); |
|
| 202 | 202 | // Submit the sitemap index to each search engine |
| 203 | 203 | try { |
| 204 | 204 | $guzzleClient->post($submissionUrl); |
| 205 | 205 | Craft::info( |
| 206 | - 'Sitemap index submitted to: '.$submissionUrl, |
|
| 206 | + 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 207 | 207 | __METHOD__ |
| 208 | 208 | ); |
| 209 | 209 | } catch (\Exception $e) { |
| 210 | 210 | Craft::error( |
| 211 | - 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 211 | + 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 212 | 212 | __METHOD__ |
| 213 | 213 | ); |
| 214 | 214 | } |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | public function invalidateSitemapCache(string $handle, int $siteId) |
| 311 | 311 | { |
| 312 | 312 | $cache = Craft::$app->getCache(); |
| 313 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 313 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 314 | 314 | Craft::info( |
| 315 | - 'Sitemap cache cleared: '.$handle, |
|
| 315 | + 'Sitemap cache cleared: ' . $handle, |
|
| 316 | 316 | __METHOD__ |
| 317 | 317 | ); |
| 318 | 318 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @inheritdoc |
| 54 | 54 | */ |
| 55 | - public function create($config = [], $add = true): MetaJsonLd |
|
| 55 | + public function create($config = [ ], $add = true): MetaJsonLd |
|
| 56 | 56 | { |
| 57 | 57 | $type = self::DEFAULT_TYPE; |
| 58 | - if (!empty($config['type'])) { |
|
| 58 | + if (!empty($config[ 'type' ])) { |
|
| 59 | 59 | $type = ArrayHelper::remove($config, 'type'); |
| 60 | 60 | } |
| 61 | 61 | $metaItem = MetaJsonLd::create($type, $config); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function add($metaItem, string $handle = self::GENERAL_HANDLE): MetaJsonLd |
| 73 | 73 | { |
| 74 | - $key = MetaJsonLdContainer::CONTAINER_TYPE.$handle; |
|
| 74 | + $key = MetaJsonLdContainer::CONTAINER_TYPE . $handle; |
|
| 75 | 75 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
| 76 | 76 | |
| 77 | 77 | /** @var MetaJsonLd $metaItem */ |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function container(string $handle = self::GENERAL_HANDLE) |
| 97 | 97 | { |
| 98 | - $key = MetaJsonLdContainer::CONTAINER_TYPE.$handle; |
|
| 98 | + $key = MetaJsonLdContainer::CONTAINER_TYPE . $handle; |
|
| 99 | 99 | |
| 100 | 100 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
| 101 | 101 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * @inheritdoc |
| 43 | 43 | */ |
| 44 | - public function create($config = [], $add = true) |
|
| 44 | + public function create($config = [ ], $add = true) |
|
| 45 | 45 | { |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | return $property->getValue(); |
| 50 | 50 | } else { |
| 51 | 51 | // Set the property |
| 52 | - $property->setValue($this, $args[0]); |
|
| 52 | + $property->setValue($this, $args[ 0 ]); |
|
| 53 | 53 | // Make it chainable |
| 54 | 54 | return $this; |
| 55 | 55 | } |