Total Complexity | 7 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class m230601_184311_announcement_google_ua_deprecated extends Migration |
||
16 | { |
||
17 | /** |
||
18 | * @inheritdoc |
||
19 | */ |
||
20 | public function safeUp() |
||
21 | { |
||
22 | if (version_compare(Craft::$app->getVersion(), '3.7', '>=')) { |
||
23 | $globalBundles = (new Query()) |
||
24 | ->from(['{{%seomatic_metabundles}}']) |
||
25 | ->where([ |
||
26 | 'sourceBundleType' => MetaBundles::GLOBAL_META_BUNDLE, |
||
27 | ]) |
||
28 | ->all(); |
||
29 | foreach ($globalBundles as $globalBundle) { |
||
30 | $metaContainers = Json::decodeIfJson($globalBundle['metaContainers']); |
||
31 | foreach ($metaContainers as $metaContainer) { |
||
32 | if ($metaContainer['class'] === MetaScriptContainer::class) { |
||
33 | $enabled = $metaContainer['data']['googleAnalytics']['include'] ?? null; |
||
34 | if ($enabled) { |
||
35 | Craft::$app->announcements->push( |
||
|
|||
36 | function ($language) { |
||
37 | return Craft::t('seomatic', 'Google Universal Analytics deprecated', [], $language); |
||
38 | }, |
||
39 | function ($language) { |
||
40 | return Craft::t('seomatic', 'Universal Analytics (which is used on this site via the SEOmatic plugin) is being [discontinued on July 1st, 2023]({url}). You should use Google gtag.js or Google Tag Manager instead and transition to a new GA4 property.', [ |
||
41 | 'url' => 'https://support.google.com/analytics/answer/11583528', |
||
42 | ], $language); |
||
43 | }, |
||
44 | 'seomatic' |
||
45 | ); |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @inheritdoc |
||
55 | */ |
||
56 | public function safeDown() |
||
60 | } |
||
61 | } |
||
62 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.