| @@ -285,7 +285,7 @@ discard block | ||
| 285 | 285 | Event::on( | 
| 286 | 286 | ClearCaches::class, | 
| 287 | 287 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, | 
| 288 | -            function (RegisterCacheOptionsEvent $event) { | |
| 288 | +            function(RegisterCacheOptionsEvent $event) { | |
| 289 | 289 | Craft::debug( | 
| 290 | 290 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', | 
| 291 | 291 | __METHOD__ | 
| @@ -301,7 +301,7 @@ discard block | ||
| 301 | 301 | Event::on( | 
| 302 | 302 | Plugins::class, | 
| 303 | 303 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, | 
| 304 | -            function (PluginEvent $event) { | |
| 304 | +            function(PluginEvent $event) { | |
| 305 | 305 |                  if ($event->plugin === $this) { | 
| 306 | 306 | // Invalidate our caches after we've been installed | 
| 307 | 307 | $this->clearAllCaches(); | 
| @@ -328,7 +328,7 @@ discard block | ||
| 328 | 328 | Event::on( | 
| 329 | 329 | CraftVariable::class, | 
| 330 | 330 | CraftVariable::EVENT_INIT, | 
| 331 | -            function (Event $event) { | |
| 331 | +            function(Event $event) { | |
| 332 | 332 | /** @var CraftVariable $variable */ | 
| 333 | 333 | $variable = $event->sender; | 
| 334 | 334 |                  $variable->set('retour', [ | 
| @@ -338,7 +338,7 @@ discard block | ||
| 338 | 338 | } | 
| 339 | 339 | ); | 
| 340 | 340 | |
| 341 | -        $prepareRedirectOnElementChange = function (ElementEvent $event) { | |
| 341 | +        $prepareRedirectOnElementChange = function(ElementEvent $event) { | |
| 342 | 342 | /** @var Element $element */ | 
| 343 | 343 | $element = $event->element; | 
| 344 | 344 |              if ($element !== null && !$element->propagating && !$event->isNew && $element->getUrl() !== null) { | 
| @@ -361,7 +361,7 @@ discard block | ||
| 361 | 361 | } | 
| 362 | 362 | }; | 
| 363 | 363 | |
| 364 | -        $insertRedirectOnElementChange = function (ElementEvent $event) { | |
| 364 | +        $insertRedirectOnElementChange = function(ElementEvent $event) { | |
| 365 | 365 | /** @var Element $element */ | 
| 366 | 366 | $element = $event->element; | 
| 367 | 367 |              if ($element !== null && !$event->isNew && $element->getUrl() !== null) { | 
| @@ -379,7 +379,7 @@ discard block | ||
| 379 | 379 | Event::on( | 
| 380 | 380 | Elements::class, | 
| 381 | 381 | Elements::EVENT_BEFORE_SAVE_ELEMENT, | 
| 382 | -            function (ElementEvent $event) use ($prepareRedirectOnElementChange) { | |
| 382 | +            function(ElementEvent $event) use ($prepareRedirectOnElementChange) { | |
| 383 | 383 | Craft::debug( | 
| 384 | 384 | 'Elements::EVENT_BEFORE_SAVE_ELEMENT', | 
| 385 | 385 | __METHOD__ | 
| @@ -391,7 +391,7 @@ discard block | ||
| 391 | 391 | Event::on( | 
| 392 | 392 | Elements::class, | 
| 393 | 393 | Elements::EVENT_AFTER_SAVE_ELEMENT, | 
| 394 | -            function (ElementEvent $event) use ($insertRedirectOnElementChange) { | |
| 394 | +            function(ElementEvent $event) use ($insertRedirectOnElementChange) { | |
| 395 | 395 | Craft::debug( | 
| 396 | 396 | 'Elements::EVENT_AFTER_SAVE_ELEMENT', | 
| 397 | 397 | __METHOD__ | 
| @@ -403,7 +403,7 @@ discard block | ||
| 403 | 403 | Event::on( | 
| 404 | 404 | Elements::class, | 
| 405 | 405 | Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI, | 
| 406 | -            function (ElementEvent $event) use ($prepareRedirectOnElementChange) { | |
| 406 | +            function(ElementEvent $event) use ($prepareRedirectOnElementChange) { | |
| 407 | 407 | Craft::debug( | 
| 408 | 408 | 'Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI', | 
| 409 | 409 | __METHOD__ | 
| @@ -415,7 +415,7 @@ discard block | ||
| 415 | 415 | Event::on( | 
| 416 | 416 | Elements::class, | 
| 417 | 417 | Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI, | 
| 418 | -            function (ElementEvent $event) use ($insertRedirectOnElementChange) { | |
| 418 | +            function(ElementEvent $event) use ($insertRedirectOnElementChange) { | |
| 419 | 419 | Craft::debug( | 
| 420 | 420 | 'Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI', | 
| 421 | 421 | __METHOD__ | 
| @@ -428,7 +428,7 @@ discard block | ||
| 428 | 428 | Event::on( | 
| 429 | 429 | Plugins::class, | 
| 430 | 430 | Plugins::EVENT_AFTER_LOAD_PLUGINS, | 
| 431 | -            function () { | |
| 431 | +            function() { | |
| 432 | 432 | // Install these only after all other plugins have loaded | 
| 433 | 433 | $request = Craft::$app->getRequest(); | 
| 434 | 434 | // Only respond to non-console site requests | 
| @@ -445,7 +445,7 @@ discard block | ||
| 445 | 445 | Event::on( | 
| 446 | 446 | Fields::class, | 
| 447 | 447 | Fields::EVENT_REGISTER_FIELD_TYPES, | 
| 448 | -            function (RegisterComponentTypesEvent $event) { | |
| 448 | +            function(RegisterComponentTypesEvent $event) { | |
| 449 | 449 | $event->types[] = ShortLinkField::class; | 
| 450 | 450 | } | 
| 451 | 451 | ); | 
| @@ -454,7 +454,7 @@ discard block | ||
| 454 | 454 | Event::on( | 
| 455 | 455 | Gql::class, | 
| 456 | 456 | Gql::EVENT_REGISTER_GQL_TYPES, | 
| 457 | -                function (RegisterGqlTypesEvent $event) { | |
| 457 | +                function(RegisterGqlTypesEvent $event) { | |
| 458 | 458 | Craft::debug( | 
| 459 | 459 | 'Gql::EVENT_REGISTER_GQL_TYPES', | 
| 460 | 460 | __METHOD__ | 
| @@ -466,7 +466,7 @@ discard block | ||
| 466 | 466 | Event::on( | 
| 467 | 467 | Gql::class, | 
| 468 | 468 | Gql::EVENT_REGISTER_GQL_QUERIES, | 
| 469 | -                function (RegisterGqlQueriesEvent $event) { | |
| 469 | +                function(RegisterGqlQueriesEvent $event) { | |
| 470 | 470 | Craft::debug( | 
| 471 | 471 | 'Gql::EVENT_REGISTER_GQL_QUERIES', | 
| 472 | 472 | __METHOD__ | 
| @@ -482,7 +482,7 @@ discard block | ||
| 482 | 482 | Event::on( | 
| 483 | 483 | Gql::class, | 
| 484 | 484 | Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS, | 
| 485 | -                    function (RegisterGqlSchemaComponentsEvent $event) { | |
| 485 | +                    function(RegisterGqlSchemaComponentsEvent $event) { | |
| 486 | 486 | Craft::debug( | 
| 487 | 487 | 'Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS', | 
| 488 | 488 | __METHOD__ | 
| @@ -512,7 +512,7 @@ discard block | ||
| 512 | 512 | Event::on( | 
| 513 | 513 | UrlManager::class, | 
| 514 | 514 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, | 
| 515 | -            function (RegisterUrlRulesEvent $event) { | |
| 515 | +            function(RegisterUrlRulesEvent $event) { | |
| 516 | 516 | Craft::debug( | 
| 517 | 517 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', | 
| 518 | 518 | __METHOD__ | 
| @@ -535,7 +535,7 @@ discard block | ||
| 535 | 535 | Event::on( | 
| 536 | 536 | Dashboard::class, | 
| 537 | 537 | Dashboard::EVENT_REGISTER_WIDGET_TYPES, | 
| 538 | -            function (RegisterComponentTypesEvent $event) { | |
| 538 | +            function(RegisterComponentTypesEvent $event) { | |
| 539 | 539 | /** @var User $user */ | 
| 540 | 540 | $user = Craft::$app->getUser(); | 
| 541 | 541 |                  if ($currentUser = $user->getIdentity()) { | 
| @@ -549,7 +549,7 @@ discard block | ||
| 549 | 549 | Event::on( | 
| 550 | 550 | UrlManager::class, | 
| 551 | 551 | UrlManager::EVENT_REGISTER_CP_URL_RULES, | 
| 552 | -            function (RegisterUrlRulesEvent $event) { | |
| 552 | +            function(RegisterUrlRulesEvent $event) { | |
| 553 | 553 | Craft::debug( | 
| 554 | 554 | 'UrlManager::EVENT_REGISTER_CP_URL_RULES', | 
| 555 | 555 | __METHOD__ | 
| @@ -565,7 +565,7 @@ discard block | ||
| 565 | 565 | Event::on( | 
| 566 | 566 | UserPermissions::class, | 
| 567 | 567 | UserPermissions::EVENT_REGISTER_PERMISSIONS, | 
| 568 | -            function (RegisterUserPermissionsEvent $event) { | |
| 568 | +            function(RegisterUserPermissionsEvent $event) { | |
| 569 | 569 | Craft::debug( | 
| 570 | 570 | 'UserPermissions::EVENT_REGISTER_PERMISSIONS', | 
| 571 | 571 | __METHOD__ | 
| @@ -587,7 +587,7 @@ discard block | ||
| 587 | 587 | Event::on( | 
| 588 | 588 | ErrorHandler::class, | 
| 589 | 589 | ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION, | 
| 590 | -            function (ExceptionEvent $event) { | |
| 590 | +            function(ExceptionEvent $event) { | |
| 591 | 591 | Craft::debug( | 
| 592 | 592 | 'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION', | 
| 593 | 593 | __METHOD__ | 
| @@ -281,7 +281,7 @@ discard block | ||
| 281 | 281 |                  try { | 
| 282 | 282 | $siteId = $redirect['siteId'] ?? null; | 
| 283 | 283 |                      if ($siteId !== null) { | 
| 284 | - $siteId = (int)$siteId; | |
| 284 | + $siteId = (int) $siteId; | |
| 285 | 285 | } | 
| 286 | 286 | $dest = UrlHelper::siteUrl($dest, null, null, $siteId); | 
| 287 | 287 |                  } catch (\yii\base\Exception $e) { | 
| @@ -296,7 +296,7 @@ discard block | ||
| 296 | 296 | // That's ok | 
| 297 | 297 | } | 
| 298 | 298 |                  if (!empty($queryString)) { | 
| 299 | - $dest = strtok($dest, '?') . '?' . $queryString; | |
| 299 | + $dest = strtok($dest, '?').'?'.$queryString; | |
| 300 | 300 | } | 
| 301 | 301 | } | 
| 302 | 302 | $redirectMatchType = $redirect['redirectMatchType'] ?? 'notfound'; | 
| @@ -411,7 +411,7 @@ discard block | ||
| 411 | 411 | public function getRedirectFromCache($url, ?int $siteId = 0) | 
| 412 | 412 |      { | 
| 413 | 413 | $cache = Craft::$app->getCache(); | 
| 414 | - $cacheKey = $this::CACHE_KEY . md5($url) . $siteId; | |
| 414 | + $cacheKey = $this::CACHE_KEY.md5($url).$siteId; | |
| 415 | 415 | $redirect = $cache->get($cacheKey); | 
| 416 | 416 | Craft::info( | 
| 417 | 417 | Craft::t( | 
| @@ -439,12 +439,12 @@ discard block | ||
| 439 | 439 |          } catch (SiteNotFoundException $e) { | 
| 440 | 440 | $siteId = 1; | 
| 441 | 441 | } | 
| 442 | - $cacheKey = $this::CACHE_KEY . md5($url) . $siteId; | |
| 442 | + $cacheKey = $this::CACHE_KEY.md5($url).$siteId; | |
| 443 | 443 | // Create the dependency tags | 
| 444 | 444 | $dependency = new TagDependency([ | 
| 445 | 445 | 'tags' => [ | 
| 446 | 446 | $this::GLOBAL_REDIRECTS_CACHE_TAG, | 
| 447 | - $this::GLOBAL_REDIRECTS_CACHE_TAG . $siteId, | |
| 447 | + $this::GLOBAL_REDIRECTS_CACHE_TAG.$siteId, | |
| 448 | 448 | ], | 
| 449 | 449 | ]); | 
| 450 | 450 | $cache->set($cacheKey, $redirect, Retour::$cacheDuration, $dependency); | 
| @@ -484,7 +484,7 @@ discard block | ||
| 484 | 484 |          foreach ($redirects as $redirect) { | 
| 485 | 485 | // Figure out what type of source matching to do | 
| 486 | 486 | $redirectSrcMatch = $redirect['redirectSrcMatch'] ?? 'pathonly'; | 
| 487 | - $redirectEnabled = (bool)$redirect['enabled']; | |
| 487 | + $redirectEnabled = (bool) $redirect['enabled']; | |
| 488 | 488 |              if ($redirectEnabled === true) { | 
| 489 | 489 |                  switch ($redirectSrcMatch) { | 
| 490 | 490 | case 'pathonly': | 
| @@ -525,12 +525,12 @@ discard block | ||
| 525 | 525 | |
| 526 | 526 | // Do a regex match | 
| 527 | 527 | case 'regexmatch': | 
| 528 | - $matchRegEx = '`' . $redirect['redirectSrcUrlParsed'] . '`i'; | |
| 528 | + $matchRegEx = '`'.$redirect['redirectSrcUrlParsed'].'`i'; | |
| 529 | 529 |                          try { | 
| 530 | 530 |                              if (preg_match($matchRegEx, $url) === 1) { | 
| 531 | 531 | $this->incrementRedirectHitCount($redirect); | 
| 532 | 532 | // If we're not associated with an EntryID, handle capture group replacement | 
| 533 | -                                if ((int)$redirect['associatedElementId'] === 0) { | |
| 533 | +                                if ((int) $redirect['associatedElementId'] === 0) { | |
| 534 | 534 | $redirect['redirectDestUrl'] = preg_replace( | 
| 535 | 535 | $matchRegEx, | 
| 536 | 536 | $redirect['redirectDestUrl'], | 
| @@ -558,7 +558,7 @@ discard block | ||
| 558 | 558 | } | 
| 559 | 559 |                          } catch (\Exception $e) { | 
| 560 | 560 | // That's fine | 
| 561 | -                            Craft::error('Invalid Redirect Regex: ' . $matchRegEx, __METHOD__); | |
| 561 | +                            Craft::error('Invalid Redirect Regex: '.$matchRegEx, __METHOD__); | |
| 562 | 562 | } | 
| 563 | 563 | |
| 564 | 564 | break; | 
| @@ -666,7 +666,7 @@ discard block | ||
| 666 | 666 |          foreach (Craft::$app->getPlugins()->getAllPlugins() as $plugin) { | 
| 667 | 667 | /** @var Plugin $plugin */ | 
| 668 | 668 |              if (method_exists($plugin, 'retourMatch')) { | 
| 669 | -                $result[$plugin->getHandle()] = $plugin->name . Craft::t('retour', ' Match'); | |
| 669 | +                $result[$plugin->getHandle()] = $plugin->name.Craft::t('retour', ' Match'); | |
| 670 | 670 | } | 
| 671 | 671 | } | 
| 672 | 672 | |
| @@ -907,7 +907,7 @@ discard block | ||
| 907 | 907 | $db = Craft::$app->getDb(); | 
| 908 | 908 | // Trigger a 'beforeDeleteRedirect' event | 
| 909 | 909 | $redirectConfig = $this->getRedirectById($id); | 
| 910 | - $isNew = (int)$redirectConfig['id'] === 0; | |
| 910 | + $isNew = (int) $redirectConfig['id'] === 0; | |
| 911 | 911 | $event = new RedirectEvent([ | 
| 912 | 912 | 'isNew' => $isNew, | 
| 913 | 913 | 'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'], | 
| @@ -968,7 +968,7 @@ discard block | ||
| 968 | 968 | 'id' => $redirectConfig['id'], | 
| 969 | 969 | ] | 
| 970 | 970 | )->execute(); | 
| 971 | -                Craft::debug('Rows affected: ' . $rowsAffected, __METHOD__); | |
| 971 | +                Craft::debug('Rows affected: '.$rowsAffected, __METHOD__); | |
| 972 | 972 |              } catch (\Exception $e) { | 
| 973 | 973 | Craft::error($e->getMessage(), __METHOD__); | 
| 974 | 974 | } | 
| @@ -1080,7 +1080,7 @@ discard block | ||
| 1080 | 1080 | // Get the validated model attributes and save them to the db | 
| 1081 | 1081 | $redirectConfig = $redirect->getAttributes(); | 
| 1082 | 1082 | // 0 for a siteId needs to be converted to null | 
| 1083 | -        if (empty($redirectConfig['siteId']) || (int)$redirectConfig['siteId'] === 0) { | |
| 1083 | +        if (empty($redirectConfig['siteId']) || (int) $redirectConfig['siteId'] === 0) { | |
| 1084 | 1084 | $redirectConfig['siteId'] = null; | 
| 1085 | 1085 | } | 
| 1086 | 1086 | // Throw an event to before saving the redirect | 
| @@ -1090,7 +1090,7 @@ discard block | ||
| 1090 | 1090 | } | 
| 1091 | 1091 | |
| 1092 | 1092 | // See if a redirect exists with this source URL already | 
| 1093 | -        if ((int)$redirectConfig['id'] === 0) { | |
| 1093 | +        if ((int) $redirectConfig['id'] === 0) { | |
| 1094 | 1094 | // Query the db table | 
| 1095 | 1095 | $redirect = (new Query()) | 
| 1096 | 1096 |                  ->from(['{{%retour_static_redirects}}']) | 
| @@ -1103,7 +1103,7 @@ discard block | ||
| 1103 | 1103 | } | 
| 1104 | 1104 | } | 
| 1105 | 1105 | // Trigger a 'beforeSaveRedirect' event | 
| 1106 | - $isNew = (int)$redirectConfig['id'] === 0; | |
| 1106 | + $isNew = (int) $redirectConfig['id'] === 0; | |
| 1107 | 1107 | $event = new RedirectEvent([ | 
| 1108 | 1108 | 'isNew' => $isNew, | 
| 1109 | 1109 | 'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'], | 
| @@ -1206,17 +1206,17 @@ discard block | ||
| 1206 | 1206 | */ | 
| 1207 | 1207 | public function excludeUri($uri): bool | 
| 1208 | 1208 |      { | 
| 1209 | - $uri = '/' . ltrim($uri, '/'); | |
| 1209 | + $uri = '/'.ltrim($uri, '/'); | |
| 1210 | 1210 |          if (!empty(Retour::$settings->excludePatterns)) { | 
| 1211 | 1211 |              foreach (Retour::$settings->excludePatterns as $excludePattern) { | 
| 1212 | - $pattern = '`' . $excludePattern['pattern'] . '`i'; | |
| 1212 | + $pattern = '`'.$excludePattern['pattern'].'`i'; | |
| 1213 | 1213 |                  try { | 
| 1214 | 1214 |                      if (preg_match($pattern, $uri) === 1) { | 
| 1215 | 1215 | return true; | 
| 1216 | 1216 | } | 
| 1217 | 1217 |                  } catch (\Exception $e) { | 
| 1218 | 1218 | // That's fine | 
| 1219 | -                    Craft::error('Invalid exclude URI Regex: ' . $pattern, __METHOD__); | |
| 1219 | +                    Craft::error('Invalid exclude URI Regex: '.$pattern, __METHOD__); | |
| 1220 | 1220 | } | 
| 1221 | 1221 | } | 
| 1222 | 1222 | } | 
| @@ -39,8 +39,8 @@ discard block | ||
| 39 | 39 | // Constants aren't allowed in traits until PHP >= 8.2 | 
| 40 | 40 | $majorVersion = '3'; | 
| 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 | // Merge in the passed config, so it our config can be overridden by Plugins::pluginConfigs['retour'] | 
| 45 | 45 | // ref: https://github.com/craftcms/cms/issues/1989 | 
| 46 | 46 | $config = ArrayHelper::merge([ | 
| @@ -53,8 +53,8 @@ discard block | ||
| 53 | 53 | 'assetClass' => RetourAsset::class, | 
| 54 | 54 | 'checkDevServer' => true, | 
| 55 | 55 | 'class' => VitePluginService::class, | 
| 56 | - 'devServerInternal' => 'http://craft-retour-' . $versionName . '-buildchain-dev:' . $devPort, | |
| 57 | - 'devServerPublic' => 'http://localhost:' . $devPort, | |
| 56 | + 'devServerInternal' => 'http://craft-retour-'.$versionName.'-buildchain-dev:'.$devPort, | |
| 57 | + 'devServerPublic' => 'http://localhost:'.$devPort, | |
| 58 | 58 | 'errorEntry' => 'src/js/Retour.js', | 
| 59 | 59 | 'useDevServer' => true, | 
| 60 | 60 | ], | 
| @@ -64,7 +64,7 @@ discard block | ||
| 64 | 64 | ->addBooleanField($field) | 
| 65 | 65 |                      ->resolve(function($redirect) use ($field) { | 
| 66 | 66 | $result = $redirect[$field] ?? null; | 
| 67 | - return $result === null ? $result : (bool)$result; | |
| 67 | + return $result === null ? $result : (bool) $result; | |
| 68 | 68 | }); | 
| 69 | 69 |              } elseif (in_array($field, self::INT_FIELDS, true)) { | 
| 70 | 70 | // Integer field | 
| @@ -72,7 +72,7 @@ discard block | ||
| 72 | 72 | ->addIntField($field) | 
| 73 | 73 |                      ->resolve(function($redirect) use ($field) { | 
| 74 | 74 | $result = $redirect[$field] ?? null; | 
| 75 | - return $result === null ? $result : (int)$result; | |
| 75 | + return $result === null ? $result : (int) $result; | |
| 76 | 76 | }); | 
| 77 | 77 |              } else { | 
| 78 | 78 | // String field | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | ->addStringField($field) | 
| 81 | 81 |                      ->resolve(function($redirect) use ($field) { | 
| 82 | 82 | $result = $redirect[$field] ?? null; | 
| 83 | - return $result === null ? $result : (string)$result; | |
| 83 | + return $result === null ? $result : (string) $result; | |
| 84 | 84 | }); | 
| 85 | 85 | } | 
| 86 | 86 | } | 
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | |
| 48 | 48 | $type = GqlEntityRegistry::createEntity(self::class, new InterfaceType([ | 
| 49 | 49 | 'name' => static::getName(), | 
| 50 | - 'fields' => self::class . '::getFieldDefinitions', | |
| 50 | + 'fields' => self::class.'::getFieldDefinitions', | |
| 51 | 51 | 'description' => 'This is the interface implemented by Retour.', | 
| 52 | 52 |              'resolveType' => function(array $value) { | 
| 53 | 53 | return GqlEntityRegistry::getEntity(RetourGenerator::getName()); | 
| @@ -41,14 +41,14 @@ discard block | ||
| 41 | 41 | 'retour' => [ | 
| 42 | 42 | 'type' => RetourInterface::getType(), | 
| 43 | 43 | 'args' => RetourArguments::getArguments(), | 
| 44 | - 'resolve' => RetourResolver::class . '::resolve', | |
| 44 | + 'resolve' => RetourResolver::class.'::resolve', | |
| 45 | 45 | 'description' => 'This query is used to query for Retour redirects.', | 
| 46 | 46 | 'deprecationReason' => 'This query is deprecated and will be removed in the future. You should use `retourResolveRedirect` instead.', | 
| 47 | 47 | ], | 
| 48 | 48 | 'retourResolveRedirect' => [ | 
| 49 | 49 | 'type' => RetourInterface::getType(), | 
| 50 | 50 | 'args' => RetourArguments::getArguments(), | 
| 51 | - 'resolve' => RetourResolver::class . '::resolve', | |
| 51 | + 'resolve' => RetourResolver::class.'::resolve', | |
| 52 | 52 | 'description' => 'This query is used to query for Retour redirects.', | 
| 53 | 53 | ], | 
| 54 | 54 | 'retourRedirects' => [ | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | 'description' => 'The siteId to list all redirects for.', | 
| 66 | 66 | ], | 
| 67 | 67 | ], | 
| 68 | - 'resolve' => RetourResolver::class . '::resolveAll', | |
| 68 | + 'resolve' => RetourResolver::class.'::resolveAll', | |
| 69 | 69 | 'description' => 'This query is used to query for all Retour redirects for a site.', | 
| 70 | 70 | ], | 
| 71 | 71 | ]; | 
| @@ -65,8 +65,8 @@ | ||
| 65 | 65 | // Set the `site` virtual field | 
| 66 | 66 | $redirect['site'] = null; | 
| 67 | 67 | $redirect['siteId'] = $siteId; | 
| 68 | -                if (isset($redirect['siteId']) && (int)$redirect['siteId'] !== 0) { | |
| 69 | - $site = Craft::$app->getSites()->getSiteById((int)$redirect['siteId']); | |
| 68 | +                if (isset($redirect['siteId']) && (int) $redirect['siteId'] !== 0) { | |
| 69 | + $site = Craft::$app->getSites()->getSiteById((int) $redirect['siteId']); | |
| 70 | 70 |                      if ($site !== null) { | 
| 71 | 71 | $redirect['site'] = $site->handle; | 
| 72 | 72 | } | 
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 | $variables['docsUrl'] = self::DOCUMENTATION_URL; | 
| 203 | 203 | $variables['pluginName'] = $pluginName; | 
| 204 | 204 | $variables['title'] = $templateTitle; | 
| 205 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; | |
| 205 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; | |
| 206 | 206 | $variables['crumbs'] = [ | 
| 207 | 207 | [ | 
| 208 | 208 | 'label' => $pluginName, | 
| @@ -210,7 +210,7 @@ discard block | ||
| 210 | 210 | ], | 
| 211 | 211 | [ | 
| 212 | 212 | 'label' => 'Redirects', | 
| 213 | -                'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri), | |
| 213 | +                'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri), | |
| 214 | 214 | ], | 
| 215 | 215 | ]; | 
| 216 | 216 |          $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}"; | 
| @@ -220,7 +220,7 @@ discard block | ||
| 220 | 220 |          $file = UploadedFile::getInstanceByName('file'); | 
| 221 | 221 |          if ($file !== null) { | 
| 222 | 222 | $filename = uniqid($file->name, true); | 
| 223 | - $filePath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $filename; | |
| 223 | + $filePath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$filename; | |
| 224 | 224 | $file->saveAs($filePath, false); | 
| 225 | 225 | // Also save the file to the cache as a backup way to access it | 
| 226 | 226 | $fileContents = @file_get_contents($filePath); | 
| @@ -353,7 +353,7 @@ discard block | ||
| 353 | 353 | } | 
| 354 | 354 | $csv->insertOne(array_values($columns)); | 
| 355 | 355 | $csv->insertAll($data); | 
| 356 | - $csv->output($filename . '.csv'); | |
| 356 | + $csv->output($filename.'.csv'); | |
| 357 | 357 | exit(0); | 
| 358 | 358 | } | 
| 359 | 359 | |
| @@ -371,7 +371,7 @@ discard block | ||
| 371 | 371 | $columns = ArrayHelper::filterEmptyStringsFromArray($columns); | 
| 372 | 372 | $rowIndex = 1; | 
| 373 | 373 | /** @phpstan-ignore-next-line */ | 
| 374 | -        $csv->each(function ($row) use ($headers, $columns, &$rowIndex, &$hasErrors) { | |
| 374 | +        $csv->each(function($row) use ($headers, $columns, &$rowIndex, &$hasErrors) { | |
| 375 | 375 | $redirectConfig = [ | 
| 376 | 376 | 'id' => 0, | 
| 377 | 377 | ]; | 
| @@ -385,9 +385,9 @@ discard block | ||
| 385 | 385 | $index++; | 
| 386 | 386 | } | 
| 387 | 387 | $redirectDump = print_r($redirectConfig, true); | 
| 388 | -            Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); | |
| 388 | +            Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); | |
| 389 | 389 |              if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { | 
| 390 | -                Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); | |
| 390 | +                Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); | |
| 391 | 391 | $hasErrors = true; | 
| 392 | 392 | } | 
| 393 | 393 | $rowIndex++; | 
| @@ -427,9 +427,9 @@ discard block | ||
| 427 | 427 | $index++; | 
| 428 | 428 | } | 
| 429 | 429 | $redirectDump = print_r($redirectConfig, true); | 
| 430 | -            Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); | |
| 430 | +            Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); | |
| 431 | 431 |              if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { | 
| 432 | -                Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); | |
| 432 | +                Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); | |
| 433 | 433 | $hasErrors = true; | 
| 434 | 434 | } | 
| 435 | 435 | $rowIndex++; | 
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | $siteId = reset($variables['enabledSiteIds']); | 
| 88 | 88 | } | 
| 89 | 89 |                  } else { | 
| 90 | -                    self::requirePermission('editSite:' . $siteId); | |
| 90 | +                    self::requirePermission('editSite:'.$siteId); | |
| 91 | 91 | } | 
| 92 | 92 | } | 
| 93 | 93 | } | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 |              } else { | 
| 113 | 113 | $variables['sitesMenuLabel'] = Craft::t( | 
| 114 | 114 | 'site', | 
| 115 | - $sites->getSiteById((int)$variables['currentSiteId'])->name | |
| 115 | + $sites->getSiteById((int) $variables['currentSiteId'])->name | |
| 116 | 116 | ); | 
| 117 | 117 | } | 
| 118 | 118 |          } else { | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 |          if ($siteHandle !== null) { | 
| 137 | 137 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); | 
| 138 | 138 |              if (!$site) { | 
| 139 | -                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); | |
| 139 | +                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); | |
| 140 | 140 | } | 
| 141 | 141 | $siteId = $site->id; | 
| 142 | 142 | } |