Passed
Push — develop-v4 ( a5ce1b...b4fdd0 )
by Andrew
05:03
created
src/helpers/Analytics.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $urlParts = parse_url($url);
71 71
             $url = $urlParts['path'] ?? '/';
72 72
             if (isset($urlParts['query'])) {
73
-                $url .= '?' . $urlParts['query'];
73
+                $url .= '?'.$urlParts['query'];
74 74
             }
75 75
         }
76 76
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $path = parse_url($url, PHP_URL_PATH);
112 112
         $pathFragments = explode('/', rtrim($path, '/'));
113 113
         $fileName = end($pathFragments);
114
-        $trackingUrl = UrlHelper::siteUrl('instantanalytics/pageViewTrack/' . $fileName, $urlParams);
114
+        $trackingUrl = UrlHelper::siteUrl('instantanalytics/pageViewTrack/'.$fileName, $urlParams);
115 115
 
116 116
         InstantAnalytics::$plugin->logAnalyticsEvent(
117 117
             'Created pageViewTrackingUrl for: {trackingUrl}',
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $urlParams = compact('url', 'eventName', 'params');
143 143
 
144 144
         $fileName = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_BASENAME);
145
-        $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/' . $fileName, $urlParams);
145
+        $trackingUrl = UrlHelper::siteUrl('instantanalytics/eventTrack/'.$fileName, $urlParams);
146 146
 
147 147
         InstantAnalytics::$plugin->logAnalyticsEvent(
148 148
             'Created eventTrackingUrl for: {trackingUrl}',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $result = true;
167 167
         $request = Craft::$app->getRequest();
168 168
 
169
-        $logExclusion = static function (string $setting)
169
+        $logExclusion = static function(string $setting)
170 170
         {
171 171
             if (InstantAnalytics::$settings->logExcludedAnalytics) {
172 172
                 $request = Craft::$app->getRequest();
Please login to merge, or discard this patch.
src/helpers/Field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -190,8 +190,8 @@
 block discarded – undo
190 190
                 // Prefix the keys with the global set name
191 191
                 $prefix = $global->handle;
192 192
                 $fields = array_combine(
193
-                    array_map(static function ($key) use ($prefix) {
194
-                        return $prefix . '.' . $key;
193
+                    array_map(static function($key) use ($prefix) {
194
+                        return $prefix.'.'.$key;
195 195
                     }, array_keys($fields)),
196 196
                     $fields
197 197
                 );
Please login to merge, or discard this patch.
src/ga4/Analytics.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * @param string $listName
180 180
      * @throws \yii\base\InvalidConfigException
181 181
      */
182
-    public function addCommerceProductImpression(Product|Variant $productVariant, $index, string $listName = 'default') {
182
+    public function addCommerceProductImpression(Product | Variant $productVariant, $index, string $listName = 'default') {
183 183
         InstantAnalytics::$plugin->commerce->addCommerceProductImpression($productVariant, $index, $listName);
184 184
     }
185 185
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             // Load them up for GA4
324 324
             foreach ($campaignParams as $key => $method) {
325 325
                 $value = $request->getParam($key) ?? $session->get($key) ?? null;
326
-                $method = 'set' . $method;
326
+                $method = 'set'.$method;
327 327
 
328 328
                 $this->$method($value);
329 329
 
Please login to merge, or discard this patch.
src/ga4/ComponentFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         ];
82 82
 
83 83
         if (!array_key_exists($componentName, $componentMap)) {
84
-            throw new \InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - ' . $componentName));
84
+            throw new \InvalidArgumentException(Craft::t('instant-analytics-ga4', 'Unknown event type - '.$componentName));
85 85
         }
86 86
         
87 87
         return new $componentMap[$componentName];
Please login to merge, or discard this patch.
src/controllers/TrackController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      *         The actions must be in 'kebab-case'
32 32
      * @access protected
33 33
      */
34
-    protected array|bool|int $allowAnonymous = [
34
+    protected array | bool | int $allowAnonymous = [
35 35
         'track-page-view-url',
36 36
         'track-event-url'
37 37
     ];
Please login to merge, or discard this patch.
src/services/ServicesTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
         // so we can't extract it from the passed in $config
40 40
         $majorVersion = '4';
41 41
         // Dev server container name & port are based on the major version of this plugin
42
-        $devPort = 3000 + (int)$majorVersion;
43
-        $versionName = 'v' . $majorVersion;
42
+        $devPort = 3000 + (int) $majorVersion;
43
+        $versionName = 'v'.$majorVersion;
44 44
         return [
45 45
             'components' => [
46 46
                 'ga4' => Ga4::class,
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                     'assetClass' => InstantAnalyticsAsset::class,
51 51
                     'checkDevServer' => true,
52 52
                     'class' => VitePluginService::class,
53
-                    'devServerInternal' => 'http://craft-instantanalytics-ga4-' . $versionName . '-buildchain-dev:' . $devPort,
54
-                    'devServerPublic' => 'http://localhost:' . $devPort,
53
+                    'devServerInternal' => 'http://craft-instantanalytics-ga4-'.$versionName.'-buildchain-dev:'.$devPort,
54
+                    'devServerPublic' => 'http://localhost:'.$devPort,
55 55
                     'errorEntry' => 'src/js/app.ts',
56 56
                     'useDevServer' => true,
57 57
                 ],
Please login to merge, or discard this patch.
src/services/Commerce.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param string $listName
212 212
      * @throws \yii\base\InvalidConfigException
213 213
      */
214
-    public function addCommerceProductImpression(Variant|Product $productVariant, int $index = 0, string $listName = 'default'): void
214
+    public function addCommerceProductImpression(Variant | Product $productVariant, int $index = 0, string $listName = 'default'): void
215 215
     {
216 216
         if ($productVariant) {
217 217
             $event = InstantAnalytics::$plugin->ga4->getAnalytics()->create()->ViewItemEvent();
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                 $name = $cat->title;
380 380
 
381 381
                 while ($cat = $cat->parent) {
382
-                    $name = $cat->title . '/' . $name;
382
+                    $name = $cat->title.'/'.$name;
383 383
                 }
384 384
 
385 385
                 $cats[] = $name;
Please login to merge, or discard this patch.
src/InstantAnalytics.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         self::$settings = $this->getSettings();
127 127
         
128 128
         // Defer most setup tasks until Craft is fully initialized
129
-        Craft::$app->onInit(function () {
129
+        Craft::$app->onInit(function() {
130 130
             // Add in our Craft components
131 131
             $this->addComponents();
132 132
             // Install our global event handlers
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
         // Add in our Twig extensions
212 212
         $view->registerTwigExtension(new InstantAnalyticsTwigExtension());
213 213
         // Install our template hook
214
-        $view->hook('iaSendPageView', fn(array $context): string => (string)$this->ga4->addPageViewEvent());
214
+        $view->hook('iaSendPageView', fn(array $context): string => (string) $this->ga4->addPageViewEvent());
215 215
 
216 216
         // Register our variables
217 217
         Event::on(
218 218
             CraftVariable::class,
219 219
             CraftVariable::EVENT_INIT,
220
-            function (Event $event): void {
220
+            function(Event $event): void {
221 221
                 /** @var CraftVariable $variable */
222 222
                 $variable = $event->sender;
223 223
                 $variable->set('instantAnalytics', [
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         Event::on(
238 238
             Plugins::class,
239 239
             Plugins::EVENT_AFTER_INSTALL_PLUGIN,
240
-            function (PluginEvent $event): void {
240
+            function(PluginEvent $event): void {
241 241
                 if ($event->plugin === $this) {
242 242
                     $request = Craft::$app->getRequest();
243 243
                     if ($request->isCpRequest) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         Event::on(
251 251
             Plugins::class,
252 252
             Plugins::EVENT_AFTER_LOAD_PLUGINS,
253
-            function () {
253
+            function() {
254 254
                 // Determine if Craft Commerce is installed & enabled
255 255
                 self::$commercePlugin = Craft::$app->getPlugins()->getPlugin(self::COMMERCE_PLUGIN_HANDLE);
256 256
                 // Determine if SEOmatic is installed & enabled
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         Event::on(
279 279
             UrlManager::class,
280 280
             UrlManager::EVENT_REGISTER_SITE_URL_RULES,
281
-            function (RegisterUrlRulesEvent $event): void {
281
+            function(RegisterUrlRulesEvent $event): void {
282 282
                 Craft::debug(
283 283
                     'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
284 284
                     __METHOD__
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         Event::on(
295 295
             View::class,
296 296
             View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE,
297
-            static function (TemplateEvent $event): void {
297
+            static function(TemplateEvent $event): void {
298 298
                 self::$currentTemplate = $event->template;
299 299
             }
300 300
         );
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         Event::on(
303 303
             View::class,
304 304
             View::EVENT_AFTER_RENDER_PAGE_TEMPLATE,
305
-            function (TemplateEvent $event): void {
305
+            function(TemplateEvent $event): void {
306 306
                 if (self::$settings->autoSendPageView) {
307 307
                     $request = Craft::$app->getRequest();
308 308
                     if (!$request->getIsAjax()) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         Event::on(
317 317
             Response::class,
318 318
             Response::EVENT_BEFORE_SEND,
319
-            function (Event $event): void {
319
+            function(Event $event): void {
320 320
                 // Initialize this sooner rather than later, since it's possible this will want to tinker with cookies
321 321
                 $this->ga4->getAnalytics();
322 322
             }
@@ -326,21 +326,21 @@  discard block
 block discarded – undo
326 326
         Event::on(
327 327
             Response::class,
328 328
             Response::EVENT_AFTER_SEND,
329
-            function (Event $event): void {
329
+            function(Event $event): void {
330 330
                 $this->ga4->getAnalytics()->sendCollectedEvents();
331 331
             }
332 332
         );
333 333
 
334 334
         // Commerce-specific hooks
335 335
         if (self::$commercePlugin !== null) {
336
-            Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function (Event $e): void {
336
+            Event::on(Order::class, Order::EVENT_AFTER_COMPLETE_ORDER, function(Event $e): void {
337 337
                 $order = $e->sender;
338 338
                 if (self::$settings->autoSendPurchaseComplete) {
339 339
                     $this->commerce->triggerOrderCompleteEvent($order);
340 340
                 }
341 341
             });
342 342
 
343
-            Event::on(Order::class, Order::EVENT_AFTER_ADD_LINE_ITEM, function (LineItemEvent $e): void {
343
+            Event::on(Order::class, Order::EVENT_AFTER_ADD_LINE_ITEM, function(LineItemEvent $e): void {
344 344
                 $lineItem = $e->lineItem;
345 345
                 if (self::$settings->autoSendAddToCart) {
346 346
                     $this->commerce->triggerAddToCartEvent($lineItem);
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
             });
349 349
 
350 350
             // Check to make sure Order::EVENT_AFTER_REMOVE_LINE_ITEM is defined
351
-            if (defined(Order::class . '::EVENT_AFTER_REMOVE_LINE_ITEM')) {
352
-                Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function (LineItemEvent $e): void {
351
+            if (defined(Order::class.'::EVENT_AFTER_REMOVE_LINE_ITEM')) {
352
+                Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function(LineItemEvent $e): void {
353 353
                     $lineItem = $e->lineItem;
354 354
                     if (self::$settings->autoSendRemoveFromCart) {
355 355
                         $this->commerce->triggerRemoveFromCartEvent($lineItem);
Please login to merge, or discard this patch.