From 4b43009f09b232630793ab212cea428813696022 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 20:53:00 -0500 Subject: [PATCH] refactor: ECS code cleanup --- src/Retour.php | 38 +++++++++---------- src/console/controllers/StatsController.php | 2 +- src/controllers/FileController.php | 4 +- src/controllers/RedirectsController.php | 5 +-- src/controllers/TablesController.php | 12 +++--- src/fields/ShortLink.php | 5 +-- src/gql/arguments/RetourArguments.php | 6 +-- src/gql/interfaces/RetourInterface.php | 11 +++--- src/gql/queries/RetourQuery.php | 10 ++--- src/gql/types/RetourType.php | 6 +-- src/gql/types/generators/RetourGenerator.php | 15 ++++---- src/helpers/Gql.php | 1 + src/migrations/Install.php | 2 +- .../m190416_212500_widget_type_update.php | 2 +- .../m221130_224500_add_priorities_column.php | 1 - src/models/Redirects.php | 6 +-- src/models/Settings.php | 4 +- src/models/StaticRedirects.php | 6 +-- src/models/Stats.php | 6 +-- src/services/Redirects.php | 15 ++++---- src/services/ServicesTrait.php | 2 +- src/translations/en/retour.php | 2 +- src/validators/UriValidator.php | 1 - src/widgets/RetourWidget.php | 1 - 24 files changed, 77 insertions(+), 86 deletions(-) diff --git a/src/Retour.php b/src/Retour.php index d384fbd5..6c662ec7 100644 --- a/src/Retour.php +++ b/src/Retour.php @@ -241,7 +241,7 @@ protected function installEventListeners(): void Event::on( ClearCaches::class, ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, - function (RegisterCacheOptionsEvent $event) { + function(RegisterCacheOptionsEvent $event) { Craft::debug( 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', __METHOD__ @@ -257,7 +257,7 @@ function (RegisterCacheOptionsEvent $event) { Event::on( Plugins::class, Plugins::EVENT_AFTER_INSTALL_PLUGIN, - function (PluginEvent $event) { + function(PluginEvent $event) { if ($event->plugin === $this) { // Invalidate our caches after we've been installed $this->clearAllCaches(); @@ -296,7 +296,7 @@ protected function installGlobalEventListeners(): void Event::on( CraftVariable::class, CraftVariable::EVENT_INIT, - function (Event $event) { + function(Event $event) { /** @var CraftVariable $variable */ $variable = $event->sender; $variable->set('retour', [ @@ -306,7 +306,7 @@ function (Event $event) { } ); - $prepareRedirectOnElementChange = function (ElementEvent $event) { + $prepareRedirectOnElementChange = function(ElementEvent $event) { /** @var Element $element */ $element = $event->element; if ($element !== null && !$event->isNew && $element->getUrl() !== null && !$element->propagating) { @@ -327,7 +327,7 @@ function (Event $event) { } }; - $insertRedirectOnElementChange = function (ElementEvent $event) { + $insertRedirectOnElementChange = function(ElementEvent $event) { /** @var Element $element */ $element = $event->element; if ($element !== null && !$event->isNew && $element->getUrl() !== null) { @@ -345,7 +345,7 @@ function (Event $event) { Event::on( Elements::class, Elements::EVENT_BEFORE_SAVE_ELEMENT, - static function (ElementEvent $event) use ($prepareRedirectOnElementChange) { + static function(ElementEvent $event) use ($prepareRedirectOnElementChange) { Craft::debug( 'Elements::EVENT_BEFORE_SAVE_ELEMENT', __METHOD__ @@ -357,7 +357,7 @@ static function (ElementEvent $event) use ($prepareRedirectOnElementChange) { Event::on( Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, - static function (ElementEvent $event) use ($insertRedirectOnElementChange) { + static function(ElementEvent $event) use ($insertRedirectOnElementChange) { Craft::debug( 'Elements::EVENT_AFTER_SAVE_ELEMENT', __METHOD__ @@ -369,7 +369,7 @@ static function (ElementEvent $event) use ($insertRedirectOnElementChange) { Event::on( Elements::class, Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI, - static function (ElementEvent $event) use ($prepareRedirectOnElementChange) { + static function(ElementEvent $event) use ($prepareRedirectOnElementChange) { Craft::debug( 'Elements::EVENT_BEFORE_UPDATE_SLUG_AND_URI', __METHOD__ @@ -381,7 +381,7 @@ static function (ElementEvent $event) use ($prepareRedirectOnElementChange) { Event::on( Elements::class, Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI, - static function (ElementEvent $event) use ($insertRedirectOnElementChange) { + static function(ElementEvent $event) use ($insertRedirectOnElementChange) { Craft::debug( 'Elements::EVENT_AFTER_UPDATE_SLUG_AND_URI', __METHOD__ @@ -393,7 +393,7 @@ static function (ElementEvent $event) use ($insertRedirectOnElementChange) { Event::on( Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, - function () { + function() { // Install these only after all other plugins have loaded $request = Craft::$app->getRequest(); // Only respond to non-console site requests @@ -410,7 +410,7 @@ function () { Event::on( Fields::class, Fields::EVENT_REGISTER_FIELD_TYPES, - function (RegisterComponentTypesEvent $event) { + function(RegisterComponentTypesEvent $event) { $event->types[] = ShortLinkField::class; } ); @@ -418,7 +418,7 @@ function (RegisterComponentTypesEvent $event) { Event::on( Gql::class, Gql::EVENT_REGISTER_GQL_TYPES, - static function (RegisterGqlTypesEvent $event) { + static function(RegisterGqlTypesEvent $event) { Craft::debug( 'Gql::EVENT_REGISTER_GQL_TYPES', __METHOD__ @@ -430,7 +430,7 @@ static function (RegisterGqlTypesEvent $event) { Event::on( Gql::class, Gql::EVENT_REGISTER_GQL_QUERIES, - static function (RegisterGqlQueriesEvent $event) { + static function(RegisterGqlQueriesEvent $event) { Craft::debug( 'Gql::EVENT_REGISTER_GQL_QUERIES', __METHOD__ @@ -445,7 +445,7 @@ static function (RegisterGqlQueriesEvent $event) { Event::on( Gql::class, Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS, - static function (RegisterGqlSchemaComponentsEvent $event) { + static function(RegisterGqlSchemaComponentsEvent $event) { Craft::debug( 'Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS', __METHOD__ @@ -467,7 +467,7 @@ protected function handleSiteRequest(): void Event::on( ErrorHandler::class, ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION, - static function (ExceptionEvent $event) { + static function(ExceptionEvent $event) { Craft::debug( 'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION', __METHOD__ @@ -505,7 +505,7 @@ protected function installSiteEventListeners(): void Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_SITE_URL_RULES, - function (RegisterUrlRulesEvent $event) { + function(RegisterUrlRulesEvent $event) { Craft::debug( 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', __METHOD__ @@ -539,7 +539,7 @@ protected function installCpEventListeners(): void Event::on( Dashboard::class, Dashboard::EVENT_REGISTER_WIDGET_TYPES, - function (RegisterComponentTypesEvent $event) { + function(RegisterComponentTypesEvent $event) { $currentUser = Craft::$app->getUser()->getIdentity(); if ($currentUser->can('accessPlugin-retour')) { $event->types[] = RetourWidget::class; @@ -550,7 +550,7 @@ function (RegisterComponentTypesEvent $event) { Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, - function (RegisterUrlRulesEvent $event) { + function(RegisterUrlRulesEvent $event) { Craft::debug( 'UrlManager::EVENT_REGISTER_CP_URL_RULES', __METHOD__ @@ -566,7 +566,7 @@ function (RegisterUrlRulesEvent $event) { Event::on( UserPermissions::class, UserPermissions::EVENT_REGISTER_PERMISSIONS, - function (RegisterUserPermissionsEvent $event) { + function(RegisterUserPermissionsEvent $event) { Craft::debug( 'UserPermissions::EVENT_REGISTER_PERMISSIONS', __METHOD__ diff --git a/src/console/controllers/StatsController.php b/src/console/controllers/StatsController.php index fd7505e5..b0603bf4 100644 --- a/src/console/controllers/StatsController.php +++ b/src/console/controllers/StatsController.php @@ -52,7 +52,7 @@ class StatsController extends Controller public function options($actionID): array { return [ - 'limit' + 'limit', ]; } diff --git a/src/controllers/FileController.php b/src/controllers/FileController.php index d8c63a03..fcc92fc3 100644 --- a/src/controllers/FileController.php +++ b/src/controllers/FileController.php @@ -48,7 +48,7 @@ class FileController extends Controller protected const DOCUMENTATION_URL = 'https://github.com/nystudio107/craft-retour/'; - const LOG_FILE_NAME = 'retour-csv-import-errors'; + public const LOG_FILE_NAME = 'retour-csv-import-errors'; protected const EXPORT_REDIRECTS_CSV_FIELDS = [ 'redirectSrcUrl' => 'Legacy URL Pattern', @@ -174,7 +174,7 @@ protected function importCsvApi8(AbstractCsv $csv, array $columns, array $header $csv->setOffset(1); $columns = ArrayHelper::filterEmptyStringsFromArray($columns); $rowIndex = 1; - $csv->each(function ($row) use ($headers, $columns, &$rowIndex, &$hasErrors) { + $csv->each(function($row) use ($headers, $columns, &$rowIndex, &$hasErrors) { $redirectConfig = [ 'id' => 0, ]; diff --git a/src/controllers/RedirectsController.php b/src/controllers/RedirectsController.php index c27aaa26..8184cf80 100644 --- a/src/controllers/RedirectsController.php +++ b/src/controllers/RedirectsController.php @@ -118,9 +118,8 @@ public function actionEditRedirect( int $redirectId = 0, string $defaultUrl = '', int $siteId = 0, - StaticRedirectsModel $redirect = null - ): Response - { + StaticRedirectsModel $redirect = null, + ): Response { $variables = []; PermissionHelper::controllerPermissionCheck('retour:redirects'); diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php index ad8be184..124bb85b 100644 --- a/src/controllers/TablesController.php +++ b/src/controllers/TablesController.php @@ -94,9 +94,8 @@ public function actionDashboard( int $per_page = 20, $filter = '', $siteId = 0, - $handled = 'all' - ): Response - { + $handled = 'all', + ): Response { PermissionHelper::controllerPermissionCheck('retour:dashboard'); $data = []; $sortField = 'hitCount'; @@ -149,7 +148,7 @@ public function actionDashboard( } $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect', [ 'defaultUrl' => $encodedUrl, - 'siteId' => $statSiteId + 'siteId' => $statSiteId, ]); } } @@ -190,9 +189,8 @@ public function actionRedirects( int $per_page = 20, $filter = '', $siteId = 0, - $shortLinks = false - ): Response - { + $shortLinks = false, + ): Response { PermissionHelper::controllerPermissionCheck('retour:redirects'); $data = []; $sortField = 'hitCount'; diff --git a/src/fields/ShortLink.php b/src/fields/ShortLink.php index b0b24669..4d06f3b8 100644 --- a/src/fields/ShortLink.php +++ b/src/fields/ShortLink.php @@ -29,11 +29,10 @@ */ class ShortLink extends Field implements PreviewableFieldInterface { - public string $redirectSrcMatch = 'pathonly'; public int $redirectHttpCode = 301; - static protected bool $allowShortLinkUpdates = true; + protected static bool $allowShortLinkUpdates = true; // Static Methods // ========================================================================= @@ -108,7 +107,7 @@ public function afterElementSave(ElementInterface $element, bool $isNew): void if ($this->translationMethod === Field::TRANSLATION_METHOD_NONE && ($element->propagating || $parentElement->propagating)) { return; } - } else if (!empty($value) && !StringHelper::startsWith($value, 'http')) { + } elseif (!empty($value) && !StringHelper::startsWith($value, 'http')) { $value = UrlHelper::siteUrl($value, null, null, $element->siteId); } diff --git a/src/gql/arguments/RetourArguments.php b/src/gql/arguments/RetourArguments.php index a44ef037..2ca08ff4 100644 --- a/src/gql/arguments/RetourArguments.php +++ b/src/gql/arguments/RetourArguments.php @@ -32,17 +32,17 @@ public static function getArguments(): array 'uri' => [ 'name' => 'uri', 'type' => Type::string(), - 'description' => 'The URI to resolve a redirect for.' + 'description' => 'The URI to resolve a redirect for.', ], 'site' => [ 'name' => 'site', 'type' => Type::string(), - 'description' => 'The site handle to resolve a redirect for.' + 'description' => 'The site handle to resolve a redirect for.', ], 'siteId' => [ 'name' => 'siteId', 'type' => Type::int(), - 'description' => 'The siteId to resolve a redirect for.' + 'description' => 'The siteId to resolve a redirect for.', ], ]; } diff --git a/src/gql/interfaces/RetourInterface.php b/src/gql/interfaces/RetourInterface.php index 885fbcfd..a5949db1 100644 --- a/src/gql/interfaces/RetourInterface.php +++ b/src/gql/interfaces/RetourInterface.php @@ -11,14 +11,13 @@ namespace nystudio107\retour\gql\interfaces; -use nystudio107\retour\gql\types\generators\RetourGenerator; - use craft\gql\base\InterfaceType as BaseInterfaceType; -use craft\gql\TypeLoader; -use craft\gql\GqlEntityRegistry; +use craft\gql\GqlEntityRegistry; use GraphQL\Type\Definition\InterfaceType; + use GraphQL\Type\Definition\Type; +use nystudio107\retour\gql\types\generators\RetourGenerator; /** * Class RetourInterface @@ -50,7 +49,7 @@ public static function getType($fields = null): Type 'name' => static::getName(), 'fields' => self::class . '::getFieldDefinitions', 'description' => 'This is the interface implemented by Retour.', - 'resolveType' => function (array $value) { + 'resolveType' => function(array $value) { return GqlEntityRegistry::getEntity(RetourGenerator::getName()); }, ])); @@ -81,7 +80,7 @@ public static function getFieldDefinitions(): array 'site' => [ 'name' => 'site', 'type' => Type::string(), - 'description' => 'The site handle of the redirect (or null for all sites).' + 'description' => 'The site handle of the redirect (or null for all sites).', ], 'siteId' => [ 'name' => 'siteId', diff --git a/src/gql/queries/RetourQuery.php b/src/gql/queries/RetourQuery.php index 3d6c184b..a5e46673 100644 --- a/src/gql/queries/RetourQuery.php +++ b/src/gql/queries/RetourQuery.php @@ -11,12 +11,12 @@ namespace nystudio107\retour\gql\queries; +use craft\gql\base\Query; +use GraphQL\Type\Definition\Type; use nystudio107\retour\gql\arguments\RetourArguments; + use nystudio107\retour\gql\interfaces\RetourInterface; use nystudio107\retour\gql\resolvers\RetourResolver; - -use craft\gql\base\Query; -use GraphQL\Type\Definition\Type; use nystudio107\retour\helpers\Gql as GqlHelper; /** @@ -57,12 +57,12 @@ public static function getQueries($checkToken = true): array 'site' => [ 'name' => 'site', 'type' => Type::string(), - 'description' => 'The site handle to list all redirects for.' + 'description' => 'The site handle to list all redirects for.', ], 'siteId' => [ 'name' => 'siteId', 'type' => Type::int(), - 'description' => 'The siteId to list all redirects for.' + 'description' => 'The siteId to list all redirects for.', ], ], 'resolve' => RetourResolver::class . '::resolveAll', diff --git a/src/gql/types/RetourType.php b/src/gql/types/RetourType.php index 470a0915..949b4f0b 100644 --- a/src/gql/types/RetourType.php +++ b/src/gql/types/RetourType.php @@ -11,13 +11,13 @@ namespace nystudio107\retour\gql\types; -use nystudio107\retour\gql\interfaces\RetourInterface; - use Craft; -use craft\gql\base\ObjectType; +use craft\gql\base\ObjectType; use GraphQL\Type\Definition\ResolveInfo; +use nystudio107\retour\gql\interfaces\RetourInterface; + /** * Class RetourType * diff --git a/src/gql/types/generators/RetourGenerator.php b/src/gql/types/generators/RetourGenerator.php index 04971061..41995065 100644 --- a/src/gql/types/generators/RetourGenerator.php +++ b/src/gql/types/generators/RetourGenerator.php @@ -11,14 +11,14 @@ namespace nystudio107\retour\gql\types\generators; -use nystudio107\retour\gql\arguments\RetourArguments; -use nystudio107\retour\gql\interfaces\RetourInterface; -use nystudio107\retour\gql\types\RetourType; - use craft\gql\base\GeneratorInterface; use craft\gql\GqlEntityRegistry; use craft\gql\TypeLoader; +use nystudio107\retour\gql\arguments\RetourArguments; +use nystudio107\retour\gql\interfaces\RetourInterface; +use nystudio107\retour\gql\types\RetourType; + /** * Class RetourGenerator * @@ -28,7 +28,6 @@ */ class RetourGenerator implements GeneratorInterface { - /** * @inheritdoc */ @@ -41,17 +40,17 @@ public static function generateTypes(mixed $context = null): array $retourType = GqlEntityRegistry::getEntity($typeName) ?: GqlEntityRegistry::createEntity($typeName, new RetourType([ 'name' => $typeName, - 'args' => function () use ($retourArgs) { + 'args' => function() use ($retourArgs) { return $retourArgs; }, - 'fields' => function () use ($retourFields) { + 'fields' => function() use ($retourFields) { return $retourFields; }, 'description' => 'This entity has all the Retour fields', ])); $gqlTypes[$typeName] = $retourType; - TypeLoader::registerType($typeName, function () use ($retourType) { + TypeLoader::registerType($typeName, function() use ($retourType) { return $retourType; }); diff --git a/src/helpers/Gql.php b/src/helpers/Gql.php index 68a1916f..ebcc96ad 100644 --- a/src/helpers/Gql.php +++ b/src/helpers/Gql.php @@ -1,4 +1,5 @@ update('{{%widgets}}', [ - 'type' => RetourWidget::class + 'type' => RetourWidget::class, ], ['type' => 'Retour']); return true; diff --git a/src/migrations/m190416_212500_widget_type_update.php b/src/migrations/m190416_212500_widget_type_update.php index 71711e4a..d151bb39 100644 --- a/src/migrations/m190416_212500_widget_type_update.php +++ b/src/migrations/m190416_212500_widget_type_update.php @@ -17,7 +17,7 @@ public function safeUp(): bool { // Update retour widget type $this->update('{{%widgets}}', [ - 'type' => RetourWidget::class + 'type' => RetourWidget::class, ], ['type' => 'Retour']); return true; diff --git a/src/migrations/m221130_224500_add_priorities_column.php b/src/migrations/m221130_224500_add_priorities_column.php index 17c949ef..c9ffb022 100644 --- a/src/migrations/m221130_224500_add_priorities_column.php +++ b/src/migrations/m221130_224500_add_priorities_column.php @@ -2,7 +2,6 @@ namespace nystudio107\retour\migrations; -use Craft; use craft\db\Migration; /** diff --git a/src/models/Redirects.php b/src/models/Redirects.php index 84814a99..fb3fbfaa 100644 --- a/src/models/Redirects.php +++ b/src/models/Redirects.php @@ -128,7 +128,7 @@ public function rules(): array 'redirectDestUrl', ], 'default', - 'value' => '' + 'value' => '', ], ['redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl'], [ @@ -147,7 +147,7 @@ public function rules(): array 'redirectDestUrl', ], DbStringValidator::class, - 'max' => 255 + 'max' => 255, ], [ [ @@ -155,7 +155,7 @@ public function rules(): array 'redirectSrcUrlParsed', 'redirectDestUrl', ], - 'string' + 'string', ], ['redirectHttpCode', 'integer'], ['redirectHttpCode', 'default', 'value' => 301], diff --git a/src/models/Settings.php b/src/models/Settings.php index aef42511..2cb7956c 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -158,7 +158,7 @@ public function rules(): array ['uriChangeRedirectSrcMatch', 'string'], ['uriChangeRedirectSrcMatch', 'in', 'range' => [ 'pathonly', - 'fullurl' + 'fullurl', ]], ['staticRedirectDisplayLimit', 'integer', 'min' => 1], ['staticRedirectDisplayLimit', 'default', 'value' => 100], @@ -175,7 +175,7 @@ public function rules(): array 'excludePatterns', 'additionalHeaders', ], - ArrayValidator::class + ArrayValidator::class, ], ]; } diff --git a/src/models/StaticRedirects.php b/src/models/StaticRedirects.php index fb895691..ace5e576 100644 --- a/src/models/StaticRedirects.php +++ b/src/models/StaticRedirects.php @@ -133,7 +133,7 @@ public function rules(): array 'redirectDestUrl', ], 'default', - 'value' => '' + 'value' => '', ], ['redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl'], [ @@ -151,7 +151,7 @@ public function rules(): array 'redirectDestUrl', ], DbStringValidator::class, - 'max' => 255 + 'max' => 255, ], [ [ @@ -159,7 +159,7 @@ public function rules(): array 'redirectSrcUrlParsed', 'redirectDestUrl', ], - 'string' + 'string', ], ['redirectHttpCode', 'integer'], ['redirectHttpCode', 'in', 'range' => [301, 302, 307, 308, 410]], diff --git a/src/models/Stats.php b/src/models/Stats.php index 38ea3d7a..d9258273 100644 --- a/src/models/Stats.php +++ b/src/models/Stats.php @@ -104,7 +104,7 @@ public function rules(): array 'exceptionFilePath', ], DbStringValidator::class, - 'max' => 255 + 'max' => 255, ], [ [ @@ -113,7 +113,7 @@ public function rules(): array 'exceptionMessage', 'exceptionFilePath', ], - 'string' + 'string', ], [ [ @@ -123,7 +123,7 @@ public function rules(): array 'exceptionFilePath', ], 'default', - 'value' => '' + 'value' => '', ], ['exceptionFileLine', 'integer'], ['exceptionFileLine', 'default', 'value' => 0], diff --git a/src/services/Redirects.php b/src/services/Redirects.php index 58053526..1f1ce91c 100644 --- a/src/services/Redirects.php +++ b/src/services/Redirects.php @@ -18,7 +18,6 @@ use craft\db\Query; use craft\errors\SiteNotFoundException; use craft\helpers\Db; -use craft\helpers\ElementHelper; use craft\helpers\StringHelper; use DateTime; use nystudio107\retour\events\RedirectEvent; @@ -104,7 +103,7 @@ class Redirects extends Component * ); * ``` */ - const EVENT_BEFORE_DELETE_REDIRECT = 'beforeDeleteRedirect'; + public const EVENT_BEFORE_DELETE_REDIRECT = 'beforeDeleteRedirect'; /** * @event RedirectEvent The event that is triggered after the redirect is deleted @@ -121,7 +120,7 @@ class Redirects extends Component * ); * ``` */ - const EVENT_AFTER_DELETE_REDIRECT = 'afterDeleteRedirect'; + public const EVENT_AFTER_DELETE_REDIRECT = 'afterDeleteRedirect'; /** * @event ResolveRedirectEvent The event that is triggered before Retour has attempted @@ -464,26 +463,26 @@ public function getStaticRedirect(string $fullUrl, string $pathOnly, $siteId, bo $siteCondition = [ 'or', ['siteId' => $siteId], - ['siteId' => null] + ['siteId' => null], ]; $pathCondition = [ 'or', ['and', ['redirectSrcMatch' => 'pathonly'], - ['redirectSrcUrlParsed' => $pathOnly] + ['redirectSrcUrlParsed' => $pathOnly], ], ['and', ['redirectSrcMatch' => 'fullurl'], - ['redirectSrcUrlParsed' => $fullUrl] + ['redirectSrcUrlParsed' => $fullUrl], ], ]; - $query = (new Query) + $query = (new Query()) ->from('{{%retour_static_redirects}}') ->where(['and', $staticCondition, $pathCondition, - $siteCondition + $siteCondition, ]) ->limit(1); diff --git a/src/services/ServicesTrait.php b/src/services/ServicesTrait.php index 0097cea8..13163c61 100644 --- a/src/services/ServicesTrait.php +++ b/src/services/ServicesTrait.php @@ -56,7 +56,7 @@ public static function config(): array 'errorEntry' => 'src/js/Retour.js', 'useDevServer' => true, ], - ] + ], ]; } diff --git a/src/translations/en/retour.php b/src/translations/en/retour.php index 711de00e..d623eb5d 100644 --- a/src/translations/en/retour.php +++ b/src/translations/en/retour.php @@ -170,5 +170,5 @@ 'Select the priority of the redirect to determine the order in which matches are checked (1 is highest priority, 9 is lowest priority).' => 'Select the priority of the redirect to determine the order in which matches are checked (1 is highest priority, 9 is lowest priority).', 'Some errors occured .' => 'Some errors occured .', 'Some errors occured importing the CSV file.' => 'Some errors occured importing the CSV file.', - 'Select the priority that will determine the order of mathching the redirect.' => 'Select the priority that will determine the order of mathching the redirect.' + 'Select the priority that will determine the order of mathching the redirect.' => 'Select the priority that will determine the order of mathching the redirect.', ]; diff --git a/src/validators/UriValidator.php b/src/validators/UriValidator.php index a9e0f190..441b681a 100644 --- a/src/validators/UriValidator.php +++ b/src/validators/UriValidator.php @@ -21,7 +21,6 @@ */ class UriValidator extends Validator { - /** * @var bool */ diff --git a/src/widgets/RetourWidget.php b/src/widgets/RetourWidget.php index 242d2333..b97b08f5 100644 --- a/src/widgets/RetourWidget.php +++ b/src/widgets/RetourWidget.php @@ -30,7 +30,6 @@ */ class RetourWidget extends Widget { - // Public Properties // =========================================================================