@@ -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') { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | foreach ($stats as &$stat) { |
136 | 136 | $stat['addLink'] = ''; |
137 | 137 | if (!$stat['handledByRetour']) { |
138 | - $encodedUrl = urlencode('/' . ltrim($stat['redirectSrcUrl'], '/')); |
|
138 | + $encodedUrl = urlencode('/'.ltrim($stat['redirectSrcUrl'], '/')); |
|
139 | 139 | // Add the siteId to the URL, but keep the current behavior of passing in siteId=0 for "all" |
140 | 140 | $statSiteId = $stat['siteId'] ?? 0; |
141 | 141 | try { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } catch (SiteNotFoundException $e) { |
144 | 144 | $primarySite = null; |
145 | 145 | } |
146 | - if ($primarySite !== null && $statSiteId == (int)$primarySite->id) { |
|
146 | + if ($primarySite !== null && $statSiteId == (int) $primarySite->id) { |
|
147 | 147 | $statSiteId = 0; |
148 | 148 | } |
149 | 149 | $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect', [ |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | ->orderBy([$sortField => $sortType]) |
219 | 219 | ->filterWhere(['like', 'redirectSrcUrl', $filter]) |
220 | 220 | ->orFilterWhere(['like', 'redirectDestUrl', $filter]); |
221 | - if ((int)$siteId !== 0) { |
|
221 | + if ((int) $siteId !== 0) { |
|
222 | 222 | $query->andWhere(['siteId' => $siteId]); |
223 | 223 | } |
224 | 224 | if ($shortLinks) { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/' . $redirect['id']); |
|
263 | + $redirect['editLink'] = UrlHelper::cpUrl('retour/edit-redirect/'.$redirect['id']); |
|
264 | 264 | } |
265 | 265 | // Format the data for the API |
266 | 266 | if ($redirects) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // Protected Properties |
89 | 89 | // ========================================================================= |
90 | 90 | |
91 | - protected array|bool|int $allowAnonymous = []; |
|
91 | + protected array | bool | int $allowAnonymous = []; |
|
92 | 92 | |
93 | 93 | // Public Methods |
94 | 94 | // ========================================================================= |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | $index++; |
192 | 192 | } |
193 | 193 | $redirectDump = print_r($redirectConfig, true); |
194 | - Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
194 | + Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
195 | 195 | if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { |
196 | - Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
196 | + Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
197 | 197 | $hasErrors = true; |
198 | 198 | } |
199 | 199 | $rowIndex++; |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $index++; |
234 | 234 | } |
235 | 235 | $redirectDump = print_r($redirectConfig, true); |
236 | - Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
236 | + Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
237 | 237 | if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { |
238 | - Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
238 | + Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
239 | 239 | $hasErrors = true; |
240 | 240 | } |
241 | 241 | $rowIndex++; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $variables['docsUrl'] = self::DOCUMENTATION_URL; |
285 | 285 | $variables['pluginName'] = $pluginName; |
286 | 286 | $variables['title'] = $templateTitle; |
287 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
287 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
288 | 288 | $variables['crumbs'] = [ |
289 | 289 | [ |
290 | 290 | 'label' => $pluginName, |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | ], |
293 | 293 | [ |
294 | 294 | 'label' => 'Redirects', |
295 | - 'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri), |
|
295 | + 'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri), |
|
296 | 296 | ], |
297 | 297 | ]; |
298 | 298 | $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}"; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $file = UploadedFile::getInstanceByName('file'); |
303 | 303 | if ($file !== null) { |
304 | 304 | $filename = uniqid($file->name, true); |
305 | - $filePath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $filename; |
|
305 | + $filePath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$filename; |
|
306 | 306 | $file->saveAs($filePath, false); |
307 | 307 | // Also save the file to the cache as a backup way to access it |
308 | 308 | $fileContents = @file_get_contents($filePath); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | $csv->insertOne(array_values($columns)); |
422 | 422 | $csv->insertAll($data); |
423 | - $csv->output($filename . '.csv'); |
|
423 | + $csv->output($filename.'.csv'); |
|
424 | 424 | exit(0); |
425 | 425 | } |
426 | 426 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @inerhitdoc |
37 | 37 | */ |
38 | - protected array|bool|int $allowAnonymous = [ |
|
38 | + protected array | bool | int $allowAnonymous = [ |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | // Public Methods |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'COUNT(handledByRetour = 1 or null) as handled_cnt', |
80 | 80 | ]) |
81 | 81 | ->where("hitLastTime >= ( CURDATE() - INTERVAL '{$days}' DAY )"); |
82 | - if ((int)$siteId !== 0) { |
|
82 | + if ((int) $siteId !== 0) { |
|
83 | 83 | $query->andWhere(['siteId' => $siteId]); |
84 | 84 | } |
85 | 85 | $query |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | "COUNT(CASE WHEN \"handledByRetour\" = true THEN 1 END) as handled_cnt", |
98 | 98 | ]) |
99 | 99 | ->where("\"hitLastTime\" >= ( CURRENT_TIMESTAMP - INTERVAL '{$days} days' )"); |
100 | - if ((int)$siteId !== 0) { |
|
100 | + if ((int) $siteId !== 0) { |
|
101 | 101 | $query->andWhere(['siteId' => $siteId]); |
102 | 102 | } |
103 | 103 | $query |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | if ($stats) { |
163 | 163 | $data = [ |
164 | - (int)$stats, |
|
165 | - (int)$handledStats, |
|
164 | + (int) $stats, |
|
165 | + (int) $handledStats, |
|
166 | 166 | ]; |
167 | 167 | } |
168 | 168 |