@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @inheritdoc |
| 55 | 55 | */ |
| 56 | - public static function iconPath(): bool|string |
|
| 56 | + public static function iconPath(): bool | string |
|
| 57 | 57 | { |
| 58 | 58 | return Craft::getAlias("@nystudio107/retour/web/assets/dist/img/icon-mask.svg"); |
| 59 | 59 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * @inheritdoc |
| 90 | 90 | */ |
| 91 | - public function getSettingsHtml(): null|string |
|
| 91 | + public function getSettingsHtml(): null | string |
|
| 92 | 92 | { |
| 93 | 93 | try { |
| 94 | 94 | return Craft::$app->getView()->renderTemplate( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * @inheritdoc |
| 111 | 111 | */ |
| 112 | - public function getBodyHtml(): null|string |
|
| 112 | + public function getBodyHtml(): null | string |
|
| 113 | 113 | { |
| 114 | 114 | try { |
| 115 | 115 | Craft::$app->getView()->registerAssetBundle(RetourWidgetAsset::class); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function getRecentStatistics(int $days = 1, bool $handled = false): array |
| 77 | 77 | { |
| 78 | 78 | // Ensure is an int |
| 79 | - $handledInt = (int)$handled; |
|
| 79 | + $handledInt = (int) $handled; |
|
| 80 | 80 | $stats = []; |
| 81 | 81 | $db = Craft::$app->getDb(); |
| 82 | 82 | if ($db->getIsMysql()) { |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | $stats->userAgent = $userAgent; |
| 212 | 212 | $stats->exceptionMessage = $exceptionMessage; |
| 213 | 213 | $stats->exceptionFilePath = $exceptionFilePath; |
| 214 | - $stats->exceptionFileLine = (int)$exceptionFileLine; |
|
| 214 | + $stats->exceptionFileLine = (int) $exceptionFileLine; |
|
| 215 | 215 | $stats->hitLastTime = Db::prepareDateForDb(new DateTime()); |
| 216 | - $stats->handledByRetour = (int)$handled; |
|
| 216 | + $stats->handledByRetour = (int) $handled; |
|
| 217 | 217 | $stats->hitCount++; |
| 218 | 218 | $statsConfig = $stats->getAttributes(); |
| 219 | 219 | // Record the updated statistics |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $now = round(microtime(true) * 1000); |
| 287 | 287 | $cache = Craft::$app->getCache(); |
| 288 | 288 | $then = $cache->get(self::LAST_STATISTICS_TRIM_CACHE_KEY); |
| 289 | - if (($then !== false) && ($now - (int)$then < Retour::$settings->statisticsRateLimitMs)) { |
|
| 289 | + if (($then !== false) && ($now - (int) $then < Retour::$settings->statisticsRateLimitMs)) { |
|
| 290 | 290 | $limited = true; |
| 291 | 291 | } |
| 292 | 292 | $cache->set(self::LAST_STATISTICS_TRIM_CACHE_KEY, $now, 0); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @var array|bool |
| 40 | 40 | */ |
| 41 | - protected array|bool $allowAnonymous = [ |
|
| 41 | + protected array | bool $allowAnonymous = [ |
|
| 42 | 42 | ]; |
| 43 | 43 | |
| 44 | 44 | // Public Methods |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function actionTrim(): int |
| 65 | 65 | { |
| 66 | - echo Craft::t('retour', 'Trimming statistics') . PHP_EOL; |
|
| 66 | + echo Craft::t('retour', 'Trimming statistics').PHP_EOL; |
|
| 67 | 67 | $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit); |
| 68 | 68 | echo Craft::t( |
| 69 | 69 | 'retour', |
| 70 | 70 | 'Trimmed {rows} from retour_stats table', |
| 71 | 71 | ['rows' => $affectedRows] |
| 72 | - ) . PHP_EOL; |
|
| 72 | + ).PHP_EOL; |
|
| 73 | 73 | |
| 74 | 74 | return 0; |
| 75 | 75 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | */ |
| 93 | 93 | public static function getLogFilePath(string $fileName): string |
| 94 | 94 | { |
| 95 | - $logfile = $fileName . "-" . date(self::FILE_PER_DAY); |
|
| 95 | + $logfile = $fileName."-".date(self::FILE_PER_DAY); |
|
| 96 | 96 | |
| 97 | 97 | return Craft::getAlias("@storage/logs/$logfile.log"); |
| 98 | 98 | } |
@@ -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 | } |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | return static function(ECSConfig $ecsConfig): void { |
| 7 | 7 | $ecsConfig->paths([ |
| 8 | - __DIR__ . '/src', |
|
| 8 | + __DIR__.'/src', |
|
| 9 | 9 | __FILE__, |
| 10 | 10 | ]); |
| 11 | 11 | $ecsConfig->parallel(); |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | // so we can't extract it from the passed in $config |
| 40 | 40 | $majorVersion = '5'; |
| 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 | 'events' => Events::class, |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | 'assetClass' => RetourAsset::class, |
| 52 | 52 | 'checkDevServer' => true, |
| 53 | 53 | 'class' => VitePluginService::class, |
| 54 | - 'devServerInternal' => 'http://craft-retour-' . $versionName . '-buildchain-dev:' . $devPort, |
|
| 55 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
| 54 | + 'devServerInternal' => 'http://craft-retour-'.$versionName.'-buildchain-dev:'.$devPort, |
|
| 55 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
| 56 | 56 | 'errorEntry' => 'src/js/Retour.js', |
| 57 | 57 | 'useDevServer' => true, |
| 58 | 58 | ], |