@@ -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(); |
@@ -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 = []; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @inheritdoc |
71 | 71 | */ |
72 | - protected array|bool|int $allowAnonymous = [ |
|
72 | + protected array | bool | int $allowAnonymous = [ |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | // Public Methods |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ->orderBy([$sortField => $sortType]) |
125 | 125 | ->filterWhere(['like', 'redirectSrcUrl', $filter]) |
126 | 126 | ->orFilterWhere(['like', 'referrerUrl', $filter]); |
127 | - if ((int)$siteId !== 0) { |
|
127 | + if ((int) $siteId !== 0) { |
|
128 | 128 | $query->andWhere(['siteId' => $siteId]); |
129 | 129 | } |
130 | 130 | if ($handled !== 'all') { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | $stat['addLink'] = ''; |
147 | 147 | if (!$stat['handledByRetour']) { |
148 | - $encodedUrl = urlencode('/' . ltrim($stat['redirectSrcUrl'], '/')); |
|
148 | + $encodedUrl = urlencode('/'.ltrim($stat['redirectSrcUrl'], '/')); |
|
149 | 149 | // Add the siteId to the URL, but keep the current behavior of passing in siteId=0 for "all" |
150 | 150 | $statSiteId = $stat['siteId'] ?? 0; |
151 | 151 | try { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } catch (SiteNotFoundException $e) { |
154 | 154 | $primarySite = null; |
155 | 155 | } |
156 | - if ($primarySite !== null && $statSiteId == (int)$primarySite->id) { |
|
156 | + if ($primarySite !== null && $statSiteId == (int) $primarySite->id) { |
|
157 | 157 | $statSiteId = 0; |
158 | 158 | } |
159 | 159 | $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect', [ |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | ->orderBy([$sortField => $sortType]) |
229 | 229 | ->filterWhere(['like', 'redirectSrcUrl', $filter]) |
230 | 230 | ->orFilterWhere(['like', 'redirectDestUrl', $filter]); |
231 | - if ((int)$siteId !== 0) { |
|
231 | + if ((int) $siteId !== 0) { |
|
232 | 232 | $query->andWhere(['siteId' => $siteId]); |
233 | 233 | } |
234 | 234 | if ($shortLinks) { |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/' . $redirect['id']); |
|
273 | + $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/'.$redirect['id']); |
|
274 | 274 | } |
275 | 275 | // Format the data for the API |
276 | 276 | if ($redirects) { |