@@ -39,8 +39,8 @@ discard block |
||
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 | '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 | ], |
@@ -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(); |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | string $sort = 'hitCount|desc', |
93 | 93 | int $page = 1, |
94 | 94 | int $per_page = 20, |
95 | - $filter = '', |
|
96 | - $siteId = 0, |
|
97 | - $handled = 'all', |
|
95 | + $filter = '', |
|
96 | + $siteId = 0, |
|
97 | + $handled = 'all', |
|
98 | 98 | ): Response { |
99 | 99 | PermissionHelper::controllerPermissionCheck('retour:dashboard'); |
100 | 100 | $data = []; |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | string $sort = 'hitCount|desc', |
188 | 188 | int $page = 1, |
189 | 189 | int $per_page = 20, |
190 | - $filter = '', |
|
191 | - $siteId = 0, |
|
192 | - $shortLinks = false, |
|
190 | + $filter = '', |
|
191 | + $siteId = 0, |
|
192 | + $shortLinks = false, |
|
193 | 193 | ): Response { |
194 | 194 | PermissionHelper::controllerPermissionCheck('retour:redirects'); |
195 | 195 | $data = []; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @inerhitdoc |
70 | 70 | */ |
71 | - protected array|bool|int $allowAnonymous = [ |
|
71 | + protected array | bool | int $allowAnonymous = [ |
|
72 | 72 | ]; |
73 | 73 | |
74 | 74 | // Public Methods |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->orderBy([$sortField => $sortType]) |
124 | 124 | ->filterWhere(['like', 'redirectSrcUrl', $filter]) |
125 | 125 | ->orFilterWhere(['like', 'referrerUrl', $filter]); |
126 | - if ((int)$siteId !== 0) { |
|
126 | + if ((int) $siteId !== 0) { |
|
127 | 127 | $query->andWhere(['siteId' => $siteId]); |
128 | 128 | } |
129 | 129 | if ($handled !== 'all') { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | $stat['addLink'] = ''; |
146 | 146 | if (!$stat['handledByRetour']) { |
147 | - $encodedUrl = urlencode('/' . ltrim($stat['redirectSrcUrl'], '/')); |
|
147 | + $encodedUrl = urlencode('/'.ltrim($stat['redirectSrcUrl'], '/')); |
|
148 | 148 | // Add the siteId to the URL, but keep the current behavior of passing in siteId=0 for "all" |
149 | 149 | $statSiteId = $stat['siteId'] ?? 0; |
150 | 150 | try { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } catch (SiteNotFoundException $e) { |
153 | 153 | $primarySite = null; |
154 | 154 | } |
155 | - if ($primarySite !== null && $statSiteId == (int)$primarySite->id) { |
|
155 | + if ($primarySite !== null && $statSiteId == (int) $primarySite->id) { |
|
156 | 156 | $statSiteId = 0; |
157 | 157 | } |
158 | 158 | $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect', [ |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ->orderBy([$sortField => $sortType]) |
228 | 228 | ->filterWhere(['like', 'redirectSrcUrl', $filter]) |
229 | 229 | ->orFilterWhere(['like', 'redirectDestUrl', $filter]); |
230 | - if ((int)$siteId !== 0) { |
|
230 | + if ((int) $siteId !== 0) { |
|
231 | 231 | $query->andWhere(['siteId' => $siteId]); |
232 | 232 | } |
233 | 233 | if ($shortLinks) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $redirect['siteBaseUrl'] = $site->getBaseUrl(); |
276 | 276 | |
277 | - $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/' . $redirect['id']); |
|
277 | + $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/'.$redirect['id']); |
|
278 | 278 | } |
279 | 279 | // Format the data for the API |
280 | 280 | if ($redirects) { |