Test Failed
Push — develop ( 7e71af...72d40f )
by Andrew
05:42
created
src/controllers/TablesController.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
         string $sort = 'hitCount|desc',
91 91
         int    $page = 1,
92 92
         int    $per_page = 20,
93
-               $filter = '',
94
-               $siteId = 0,
95
-               $handled = 'all'
93
+                $filter = '',
94
+                $siteId = 0,
95
+                $handled = 'all'
96 96
     ): Response
97 97
     {
98 98
         PermissionHelper::controllerPermissionCheck('retour:dashboard');
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
         string $sort = 'hitCount|desc',
187 187
         int    $page = 1,
188 188
         int    $per_page = 20,
189
-               $filter = '',
190
-               $siteId = 0,
191
-               $shortLinks = false
189
+                $filter = '',
190
+                $siteId = 0,
191
+                $shortLinks = false
192 192
     ): Response
193 193
     {
194 194
         PermissionHelper::controllerPermissionCheck('retour:redirects');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             ->orderBy([$sortField => $sortType])
123 123
             ->filterWhere(['like', 'redirectSrcUrl', $filter])
124 124
             ->orFilterWhere(['like', 'referrerUrl', $filter]);
125
-        if ((int)$siteId !== 0) {
125
+        if ((int) $siteId !== 0) {
126 126
             $query->andWhere(['siteId' => $siteId]);
127 127
         }
128 128
         if ($handled !== 'all') {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             foreach ($stats as &$stat) {
135 135
                 $stat['addLink'] = '';
136 136
                 if (!$stat['handledByRetour']) {
137
-                    $encodedUrl = urlencode('/' . ltrim($stat['redirectSrcUrl'], '/'));
137
+                    $encodedUrl = urlencode('/'.ltrim($stat['redirectSrcUrl'], '/'));
138 138
                     // Add the siteId to the URL, but keep the current behavior of passing in siteId=0 for "all"
139 139
                     $statSiteId = $stat['siteId'] ?? 0;
140 140
                     try {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     } catch (SiteNotFoundException $e) {
143 143
                         $primarySite = null;
144 144
                     }
145
-                    if ($primarySite !== null && $statSiteId == (int)$primarySite->id) {
145
+                    if ($primarySite !== null && $statSiteId == (int) $primarySite->id) {
146 146
                         $statSiteId = 0;
147 147
                     }
148 148
                     $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect', [
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             ->orderBy([$sortField => $sortType])
219 219
             ->filterWhere(['like', 'redirectSrcUrl', $filter])
220 220
             ->orFilterWhere(['like', 'redirectDestUrl', $filter]);
221
-        if ((int)$siteId !== 0) {
221
+        if ((int) $siteId !== 0) {
222 222
             $query->andWhere(['siteId' => $siteId]);
223 223
         }
224 224
         if ($shortLinks) {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 }
246 246
             }
247 247
 
248
-            $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/' . $redirect['id']);
248
+            $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/'.$redirect['id']);
249 249
         }
250 250
         // Format the data for the API
251 251
         if ($redirects) {
Please login to merge, or discard this patch.
src/controllers/RedirectsController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $variables['docsUrl'] = self::DOCUMENTATION_URL;
82 82
         $variables['pluginName'] = $pluginName;
83 83
         $variables['title'] = $templateTitle;
84
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
84
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
85 85
         $variables['crumbs'] = [
86 86
             [
87 87
                 'label' => $pluginName,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             ],
90 90
             [
91 91
                 'label' => $templateTitle,
92
-                'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri),
92
+                'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri),
93 93
             ],
94 94
         ];
95 95
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         if ($redirect->siteId) {
151 151
             $site = $sites->getSiteById($redirect->siteId);
152 152
             if ($site) {
153
-                MultiSiteHelper::requirePermission('editSite:' . $site->uid);
153
+                MultiSiteHelper::requirePermission('editSite:'.$site->uid);
154 154
             }
155 155
         }
156 156
         if ($siteId) {
157 157
             $site = $sites->getSiteById($siteId);
158 158
             if ($site) {
159
-                MultiSiteHelper::requirePermission('editSite:' . $site->uid);
159
+                MultiSiteHelper::requirePermission('editSite:'.$site->uid);
160 160
             }
161 161
         }
162 162
         $pluginName = Retour::$settings->pluginName;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             ],
193 193
             [
194 194
                 'label' => $templateTitle,
195
-                'url' => UrlHelper::cpUrl('retour/edit-redirect/' . $redirectId),
195
+                'url' => UrlHelper::cpUrl('retour/edit-redirect/'.$redirectId),
196 196
             ],
197 197
         ];
198 198
         $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}";
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         if ($redirectConfig === null) {
251 251
             throw new NotFoundHttpException('Redirect not found');
252 252
         }
253
-        $redirectConfig['id'] = (int)$redirectConfig['id'];
253
+        $redirectConfig['id'] = (int) $redirectConfig['id'];
254 254
         // Handle enforcing trailing slashes
255 255
         $generalConfig = Craft::$app->getConfig()->getGeneral();
256 256
         if ($generalConfig->addTrailingSlashesToUrls && $redirectConfig['redirectMatchType'] === 'exactmatch') {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $variables['docsUrl'] = self::DOCUMENTATION_URL;
335 335
         $variables['pluginName'] = $pluginName;
336 336
         $variables['title'] = $templateTitle;
337
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
337
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
338 338
         $variables['crumbs'] = [
339 339
             [
340 340
                 'label' => $pluginName,
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             ],
343 343
             [
344 344
                 'label' => $templateTitle,
345
-                'url' => UrlHelper::cpUrl('retour/shortlinks' . $siteHandleUri),
345
+                'url' => UrlHelper::cpUrl('retour/shortlinks'.$siteHandleUri),
346 346
             ],
347 347
         ];
348 348
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
         if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false) {
398 398
             // If it's a root relative URL, assume it's a site URL
399 399
             if (UrlHelper::isRootRelativeUrl($url)) {
400
-                return rtrim($url, '/') . '/';
400
+                return rtrim($url, '/').'/';
401 401
             }
402 402
             // If the URL matches any of the site's base URLs, assume it's a site URL
403 403
             $sites = Craft::$app->getSites()->getAllSites();
404 404
             foreach ($sites as $site) {
405 405
                 if (strpos($url, $site->getBaseUrl()) === 0) {
406
-                    return rtrim($url, '/') . '/';
406
+                    return rtrim($url, '/').'/';
407 407
                 }
408 408
             }
409 409
         }
Please login to merge, or discard this patch.
src/helpers/MultiSite.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                         $siteId = reset($variables['enabledSiteIds']);
90 90
                     }
91 91
                 } else {
92
-                    self::requirePermission('editSite:' . $siteId);
92
+                    self::requirePermission('editSite:'.$siteId);
93 93
                 }
94 94
             }
95 95
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             } else {
115 115
                 $variables['sitesMenuLabel'] = Craft::t(
116 116
                     'site',
117
-                    $sites->getSiteById((int)$variables['currentSiteId'])->name
117
+                    $sites->getSiteById((int) $variables['currentSiteId'])->name
118 118
                 );
119 119
             }
120 120
         } else {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if ($siteHandle !== null) {
138 138
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
139 139
             if (!$site) {
140
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
140
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
141 141
             }
142 142
             $siteId = $site->id;
143 143
         } else {
Please login to merge, or discard this patch.
src/validators/UriValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
             return;
61 61
         }
62 62
         // Make sure there is a leading /
63
-        $value = '/' . ltrim($value, '/');
63
+        $value = '/'.ltrim($value, '/');
64 64
         $model->$attribute = $value;
65 65
     }
66 66
 }
Please login to merge, or discard this patch.
src/gql/interfaces/RetourInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@
 block discarded – undo
48 48
 
49 49
         $type = GqlEntityRegistry::createEntity(self::class, new InterfaceType([
50 50
             'name' => static::getName(),
51
-            'fields' => self::class . '::getFieldDefinitions',
51
+            'fields' => self::class.'::getFieldDefinitions',
52 52
             'description' => 'This is the interface implemented by Retour.',
53
-            'resolveType' => function (array $value) {
53
+            'resolveType' => function(array $value) {
54 54
                 return GqlEntityRegistry::getEntity(RetourGenerator::getName());
55 55
             },
56 56
         ]));
Please login to merge, or discard this patch.
src/controllers/StatisticsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $variables['docsUrl'] = self::DOCUMENTATION_URL;
85 85
         $variables['pluginName'] = $pluginName;
86 86
         $variables['title'] = $templateTitle;
87
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
87
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
88 88
         $variables['crumbs'] = [
89 89
             [
90 90
                 'label' => $pluginName,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             ],
93 93
             [
94 94
                 'label' => $templateTitle,
95
-                'url' => UrlHelper::cpUrl('retour/dashboard' . $siteHandleUri),
95
+                'url' => UrlHelper::cpUrl('retour/dashboard'.$siteHandleUri),
96 96
             ],
97 97
         ];
98 98
         $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
Please login to merge, or discard this patch.
src/console/controllers/StatsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@
 block discarded – undo
66 66
      */
67 67
     public function actionTrim(): int
68 68
     {
69
-        echo Craft::t('retour', 'Trimming statistics') . PHP_EOL;
69
+        echo Craft::t('retour', 'Trimming statistics').PHP_EOL;
70 70
         $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit);
71 71
         echo Craft::t(
72 72
                 'retour',
73 73
                 'Trimmed {rows} from retour_stats table',
74 74
                 ['rows' => $affectedRows]
75
-            ) . PHP_EOL;
75
+            ).PHP_EOL;
76 76
 
77 77
         return 0;
78 78
     }
Please login to merge, or discard this patch.
src/Retour.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         Event::on(
280 280
             ClearCaches::class,
281 281
             ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
282
-            function (RegisterCacheOptionsEvent $event) {
282
+            function(RegisterCacheOptionsEvent $event) {
283 283
                 Craft::debug(
284 284
                     'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS',
285 285
                     __METHOD__
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         Event::on(
296 296
             Plugins::class,
297 297
             Plugins::EVENT_AFTER_INSTALL_PLUGIN,
298
-            function (PluginEvent $event) {
298
+            function(PluginEvent $event) {
299 299
                 if ($event->plugin === $this) {
300 300
                     // Invalidate our caches after we've been installed
301 301
                     $this->clearAllCaches();
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         Event::on(
323 323
             CraftVariable::class,
324 324
             CraftVariable::EVENT_INIT,
325
-            function (Event $event) {
325
+            function(Event $event) {
326 326
                 /** @var CraftVariable $variable */
327 327
                 $variable = $event->sender;
328 328
                 $variable->set('retour', [
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             }
333 333
         );
334 334
 
335
-        $prepareRedirectOnElementChange = function (ElementEvent $event) {
335
+        $prepareRedirectOnElementChange = function(ElementEvent $event) {
336 336
             /** @var Element $element */
337 337
             $element = $event->element;
338 338
             if ($element !== null && !$event->isNew && $element->getUrl() !== null && !$element->propagating) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             }
356 356
         };
357 357
 
358
-        $insertRedirectOnElementChange = function (ElementEvent $event) {
358
+        $insertRedirectOnElementChange = function(ElementEvent $event) {
359 359
             /** @var Element $element */
360 360
             $element = $event->element;
361 361
             if ($element !== null && !$event->isNew && $element->getUrl() !== null) {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         Event::on(
374 374
             Elements::class,
375 375
             Elements::EVENT_BEFORE_SAVE_ELEMENT,
376
-            function (ElementEvent $event) use ($prepareRedirectOnElementChange) {
376
+            function(ElementEvent $event) use ($prepareRedirectOnElementChange) {
377 377
                 Craft::debug(
378 378
                     'Elements::EVENT_BEFORE_SAVE_ELEMENT',
379 379
                     __METHOD__
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         Event::on(
386 386
             Elements::class,
387 387
             Elements::EVENT_AFTER_SAVE_ELEMENT,
388
-            function (ElementEvent $event) use ($insertRedirectOnElementChange) {
388
+            function(ElementEvent $event) use ($insertRedirectOnElementChange) {
389 389
                 Craft::debug(
390 390
                     'Elements::EVENT_AFTER_SAVE_ELEMENT',
391 391
                     __METHOD__
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         Event::on(
398 398
             Elements::class,
399 399
             Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI,
400
-            function (ElementEvent $event) use ($prepareRedirectOnElementChange) {
400
+            function(ElementEvent $event) use ($prepareRedirectOnElementChange) {
401 401
                 Craft::debug(
402 402
                     'Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI',
403 403
                     __METHOD__
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         Event::on(
410 410
             Elements::class,
411 411
             Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI,
412
-            function (ElementEvent $event) use ($insertRedirectOnElementChange) {
412
+            function(ElementEvent $event) use ($insertRedirectOnElementChange) {
413 413
                 Craft::debug(
414 414
                     'Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI',
415 415
                     __METHOD__
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         Event::on(
423 423
             Plugins::class,
424 424
             Plugins::EVENT_AFTER_LOAD_PLUGINS,
425
-            function () {
425
+            function() {
426 426
                 // Install these only after all other plugins have loaded
427 427
                 $request = Craft::$app->getRequest();
428 428
                 // Only respond to non-console site requests
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         Event::on(
440 440
             Fields::class,
441 441
             Fields::EVENT_REGISTER_FIELD_TYPES,
442
-            function (RegisterComponentTypesEvent $event) {
442
+            function(RegisterComponentTypesEvent $event) {
443 443
                 $event->types[] = ShortLinkField::class;
444 444
             }
445 445
         );
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             Event::on(
449 449
                 Gql::class,
450 450
                 Gql::EVENT_REGISTER_GQL_TYPES,
451
-                function (RegisterGqlTypesEvent $event) {
451
+                function(RegisterGqlTypesEvent $event) {
452 452
                     Craft::debug(
453 453
                         'Gql::EVENT_REGISTER_GQL_TYPES',
454 454
                         __METHOD__
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             Event::on(
461 461
                 Gql::class,
462 462
                 Gql::EVENT_REGISTER_GQL_QUERIES,
463
-                function (RegisterGqlQueriesEvent $event) {
463
+                function(RegisterGqlQueriesEvent $event) {
464 464
                     Craft::debug(
465 465
                         'Gql::EVENT_REGISTER_GQL_QUERIES',
466 466
                         __METHOD__
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                 Event::on(
477 477
                     Gql::class,
478 478
                     Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS,
479
-                    function (RegisterGqlSchemaComponentsEvent $event) {
479
+                    function(RegisterGqlSchemaComponentsEvent $event) {
480 480
                         Craft::debug(
481 481
                             'Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS',
482 482
                             __METHOD__
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         Event::on(
507 507
             UrlManager::class,
508 508
             UrlManager::EVENT_REGISTER_SITE_URL_RULES,
509
-            function (RegisterUrlRulesEvent $event) {
509
+            function(RegisterUrlRulesEvent $event) {
510 510
                 Craft::debug(
511 511
                     'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
512 512
                     __METHOD__
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
         Event::on(
530 530
             Dashboard::class,
531 531
             Dashboard::EVENT_REGISTER_WIDGET_TYPES,
532
-            function (RegisterComponentTypesEvent $event) {
532
+            function(RegisterComponentTypesEvent $event) {
533 533
                 $currentUser = Craft::$app->getUser()->getIdentity();
534 534
                 if ($currentUser->can('accessPlugin-retour')) {
535 535
                     $event->types[] = RetourWidget::class;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         Event::on(
541 541
             UrlManager::class,
542 542
             UrlManager::EVENT_REGISTER_CP_URL_RULES,
543
-            function (RegisterUrlRulesEvent $event) {
543
+            function(RegisterUrlRulesEvent $event) {
544 544
                 Craft::debug(
545 545
                     'UrlManager::EVENT_REGISTER_CP_URL_RULES',
546 546
                     __METHOD__
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
         Event::on(
557 557
             UserPermissions::class,
558 558
             UserPermissions::EVENT_REGISTER_PERMISSIONS,
559
-            function (RegisterUserPermissionsEvent $event) {
559
+            function(RegisterUserPermissionsEvent $event) {
560 560
                 Craft::debug(
561 561
                     'UserPermissions::EVENT_REGISTER_PERMISSIONS',
562 562
                     __METHOD__
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
         Event::on(
579 579
             ErrorHandler::class,
580 580
             ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION,
581
-            function (ExceptionEvent $event) {
581
+            function(ExceptionEvent $event) {
582 582
                 Craft::debug(
583 583
                     'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION',
584 584
                     __METHOD__
Please login to merge, or discard this patch.
src/services/Redirects.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 try {
292 292
                     $siteId = $redirect['siteId'] ?? null;
293 293
                     if ($siteId !== null) {
294
-                        $siteId = (int)$siteId;
294
+                        $siteId = (int) $siteId;
295 295
                     }
296 296
                     $dest = UrlHelper::siteUrl($dest, null, null, $siteId);
297 297
                 } catch (\yii\base\Exception $e) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                     // That's ok
307 307
                 }
308 308
                 if (!empty($queryString)) {
309
-                    $dest = strtok($dest, '?') . '?' . $queryString;
309
+                    $dest = strtok($dest, '?').'?'.$queryString;
310 310
                 }
311 311
             }
312 312
             $redirectMatchType = $redirect['redirectMatchType'] ?? 'notfound';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     public function getRedirectFromCache($url, int $siteId = 0)
424 424
     {
425 425
         $cache = Craft::$app->getCache();
426
-        $cacheKey = $this::CACHE_KEY . md5($url) . $siteId;
426
+        $cacheKey = $this::CACHE_KEY.md5($url).$siteId;
427 427
         $redirect = $cache->get($cacheKey);
428 428
         Craft::info(
429 429
             Craft::t(
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
         } catch (SiteNotFoundException $e) {
452 452
             $siteId = 1;
453 453
         }
454
-        $cacheKey = $this::CACHE_KEY . md5($url) . $siteId;
454
+        $cacheKey = $this::CACHE_KEY.md5($url).$siteId;
455 455
         // Create the dependency tags
456 456
         $dependency = new TagDependency([
457 457
             'tags' => [
458 458
                 $this::GLOBAL_REDIRECTS_CACHE_TAG,
459
-                $this::GLOBAL_REDIRECTS_CACHE_TAG . $siteId,
459
+                $this::GLOBAL_REDIRECTS_CACHE_TAG.$siteId,
460 460
             ],
461 461
         ]);
462 462
         $cache->set($cacheKey, $redirect, Retour::$cacheDuration, $dependency);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
         foreach ($redirects as $redirect) {
497 497
             // Figure out what type of source matching to do
498 498
             $redirectSrcMatch = $redirect['redirectSrcMatch'] ?? 'pathonly';
499
-            $redirectEnabled = (bool)$redirect['enabled'];
499
+            $redirectEnabled = (bool) $redirect['enabled'];
500 500
             if ($redirectEnabled === true) {
501 501
                 switch ($redirectSrcMatch) {
502 502
                     case 'pathonly':
@@ -537,12 +537,12 @@  discard block
 block discarded – undo
537 537
 
538 538
                     // Do a regex match
539 539
                     case 'regexmatch':
540
-                        $matchRegEx = '`' . $redirect['redirectSrcUrlParsed'] . '`i';
540
+                        $matchRegEx = '`'.$redirect['redirectSrcUrlParsed'].'`i';
541 541
                         try {
542 542
                             if (preg_match($matchRegEx, $url) === 1) {
543 543
                                 $this->incrementRedirectHitCount($redirect);
544 544
                                 // If we're not associated with an EntryID, handle capture group replacement
545
-                                if ((int)$redirect['associatedElementId'] === 0) {
545
+                                if ((int) $redirect['associatedElementId'] === 0) {
546 546
                                     $redirect['redirectDestUrl'] = preg_replace(
547 547
                                         $matchRegEx,
548 548
                                         $redirect['redirectDestUrl'],
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                             }
571 571
                         } catch (\Exception $e) {
572 572
                             // That's fine
573
-                            Craft::error('Invalid Redirect Regex: ' . $matchRegEx, __METHOD__);
573
+                            Craft::error('Invalid Redirect Regex: '.$matchRegEx, __METHOD__);
574 574
                         }
575 575
 
576 576
                         break;
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         foreach (Craft::$app->getPlugins()->getAllPlugins() as $plugin) {
679 679
             /** @var Plugin $plugin */
680 680
             if (method_exists($plugin, 'retourMatch')) {
681
-                $result[$plugin->getHandle()] = $plugin->name . Craft::t('retour', ' Match');
681
+                $result[$plugin->getHandle()] = $plugin->name.Craft::t('retour', ' Match');
682 682
             }
683 683
         }
684 684
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
         $db = Craft::$app->getDb();
903 903
         // Trigger a 'beforeDeleteRedirect' event
904 904
         $redirectConfig = $this->getRedirectById($id);
905
-        $isNew = (int)$redirectConfig['id'] === 0;
905
+        $isNew = (int) $redirectConfig['id'] === 0;
906 906
         $event = new RedirectEvent([
907 907
             'isNew' => $isNew,
908 908
             'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'],
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                         'id' => $redirectConfig['id'],
964 964
                     ]
965 965
                 )->execute();
966
-                Craft::debug('Rows affected: ' . $rowsAffected, __METHOD__);
966
+                Craft::debug('Rows affected: '.$rowsAffected, __METHOD__);
967 967
             } catch (\Exception $e) {
968 968
                 Craft::error($e->getMessage(), __METHOD__);
969 969
             }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         // Get the validated model attributes and save them to the db
1095 1095
         $redirectConfig = $redirect->getAttributes();
1096 1096
         // 0 for a siteId needs to be converted to null
1097
-        if (empty($redirectConfig['siteId']) || (int)$redirectConfig['siteId'] === 0) {
1097
+        if (empty($redirectConfig['siteId']) || (int) $redirectConfig['siteId'] === 0) {
1098 1098
             $redirectConfig['siteId'] = null;
1099 1099
         }
1100 1100
         // Throw an event to before saving the redirect
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
         }
1105 1105
 
1106 1106
         // See if a redirect exists with this source URL already
1107
-        if ((int)$redirectConfig['id'] === 0) {
1107
+        if ((int) $redirectConfig['id'] === 0) {
1108 1108
             // Query the db table
1109 1109
             $redirect = (new Query())
1110 1110
                 ->from(['{{%retour_static_redirects}}'])
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
             }
1118 1118
         }
1119 1119
         // Trigger a 'beforeSaveRedirect' event
1120
-        $isNew = (int)$redirectConfig['id'] === 0;
1120
+        $isNew = (int) $redirectConfig['id'] === 0;
1121 1121
         $event = new RedirectEvent([
1122 1122
             'isNew' => $isNew,
1123 1123
             'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'],
@@ -1220,17 +1220,17 @@  discard block
 block discarded – undo
1220 1220
      */
1221 1221
     public function excludeUri($uri): bool
1222 1222
     {
1223
-        $uri = '/' . ltrim($uri, '/');
1223
+        $uri = '/'.ltrim($uri, '/');
1224 1224
         if (!empty(Retour::$settings->excludePatterns)) {
1225 1225
             foreach (Retour::$settings->excludePatterns as $excludePattern) {
1226
-                $pattern = '`' . $excludePattern['pattern'] . '`i';
1226
+                $pattern = '`'.$excludePattern['pattern'].'`i';
1227 1227
                 try {
1228 1228
                     if (preg_match($pattern, $uri) === 1) {
1229 1229
                         return true;
1230 1230
                     }
1231 1231
                 } catch (\Exception $e) {
1232 1232
                     // That's fine
1233
-                    Craft::error('Invalid exclude URI Regex: ' . $pattern, __METHOD__);
1233
+                    Craft::error('Invalid exclude URI Regex: '.$pattern, __METHOD__);
1234 1234
                 }
1235 1235
             }
1236 1236
         }
Please login to merge, or discard this patch.