Passed
Push — v3 ( 4a04ce...9dbba2 )
by Andrew
15:26 queued 21s
created
src/gql/interfaces/RetourInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
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());
Please login to merge, or discard this patch.
src/gql/queries/RetourQuery.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         ];
Please login to merge, or discard this patch.
src/gql/resolvers/RetourResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@
 block discarded – undo
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
                     }
Please login to merge, or discard this patch.
src/helpers/MultiSite.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                         $siteId = reset($variables['enabledSiteIds']);
88 88
                     }
89 89
                 } else {
90
-                    self::requirePermission('editSite:' . $siteId);
90
+                    self::requirePermission('editSite:'.$siteId);
91 91
                 }
92 92
             }
93 93
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             } else {
113 113
                 $variables['sitesMenuLabel'] = Craft::t(
114 114
                     'site',
115
-                    $sites->getSiteById((int)$variables['currentSiteId'])->name
115
+                    $sites->getSiteById((int) $variables['currentSiteId'])->name
116 116
                 );
117 117
             }
118 118
         } else {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         if ($siteHandle !== null) {
137 137
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
138 138
             if (!$site) {
139
-                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
139
+                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
140 140
             }
141 141
             $siteId = $site->id;
142 142
         }
Please login to merge, or discard this patch.
ecs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/services/Statistics.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function getRecentStatistics($days = 1, $handled = false): array
78 78
     {
79 79
         // Ensure is an int
80
-        $handledInt = (int)$handled;
80
+        $handledInt = (int) $handled;
81 81
         $stats = [];
82 82
         $db = Craft::$app->getDb();
83 83
         if ($db->getIsMysql()) {
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         $stats->userAgent = $userAgent;
213 213
         $stats->exceptionMessage = $exceptionMessage;
214 214
         $stats->exceptionFilePath = $exceptionFilePath;
215
-        $stats->exceptionFileLine = (int)$exceptionFileLine;
215
+        $stats->exceptionFileLine = (int) $exceptionFileLine;
216 216
         $stats->hitLastTime = Db::prepareDateForDb(new DateTime());
217
-        $stats->handledByRetour = (int)$handled;
217
+        $stats->handledByRetour = (int) $handled;
218 218
         $stats->hitCount++;
219 219
         $statsConfig = $stats->getAttributes();
220 220
         // Record the updated statistics
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $now = round(microtime(true) * 1000);
359 359
         $cache = Craft::$app->getCache();
360 360
         $then = $cache->get(self::LAST_STATISTICS_TRIM_CACHE_KEY);
361
-        if (($then !== false) && ($now - (int)$then < Retour::$settings->statisticsRateLimitMs)) {
361
+        if (($then !== false) && ($now - (int) $then < Retour::$settings->statisticsRateLimitMs)) {
362 362
             $limited = true;
363 363
         }
364 364
         $cache->set(self::LAST_STATISTICS_TRIM_CACHE_KEY, $now, 0);
Please login to merge, or discard this patch.
src/controllers/TablesController.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         string $sort = 'hitCount|desc',
94 94
         int    $page = 1,
95 95
         int    $per_page = 20,
96
-               $filter = '',
97
-               $siteId = 0,
98
-               $handled = 'all'
96
+                $filter = '',
97
+                $siteId = 0,
98
+                $handled = 'all'
99 99
     ): Response {
100 100
         PermissionHelper::controllerPermissionCheck('retour:dashboard');
101 101
         $data = [];
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         string $sort = 'hitCount|desc',
198 198
         int    $page = 1,
199 199
         int    $per_page = 20,
200
-               $filter = '',
201
-               $siteId = 0,
202
-               $shortLinks = false
200
+                $filter = '',
201
+                $siteId = 0,
202
+                $shortLinks = false
203 203
     ): Response {
204 204
         PermissionHelper::controllerPermissionCheck('retour:redirects');
205 205
         $data = [];
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/controllers/FileController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $variables['docsUrl'] = self::DOCUMENTATION_URL;
204 204
         $variables['pluginName'] = $pluginName;
205 205
         $variables['title'] = $templateTitle;
206
-        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
206
+        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
207 207
         $variables['crumbs'] = [
208 208
             [
209 209
                 'label' => $pluginName,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             ],
212 212
             [
213 213
                 'label' => 'Redirects',
214
-                'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri),
214
+                'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri),
215 215
             ],
216 216
         ];
217 217
         $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}";
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $file = UploadedFile::getInstanceByName('file');
222 222
         if ($file !== null) {
223 223
             $filename = uniqid($file->name, true);
224
-            $filePath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $filename;
224
+            $filePath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$filename;
225 225
             $file->saveAs($filePath, false);
226 226
             // Also save the file to the cache as a backup way to access it
227 227
             $fileContents = @file_get_contents($filePath);
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         }
355 355
         $csv->insertOne(array_values($columns));
356 356
         $csv->insertAll($data);
357
-        $csv->output($filename . '.csv');
357
+        $csv->output($filename.'.csv');
358 358
         exit(0);
359 359
     }
360 360
 
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
                 $index++;
387 387
             }
388 388
             $redirectDump = print_r($redirectConfig, true);
389
-            Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__);
389
+            Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__);
390 390
             if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) {
391
-                Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__);
391
+                Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__);
392 392
                 $hasErrors = true;
393 393
             }
394 394
             $rowIndex++;
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
                 $index++;
429 429
             }
430 430
             $redirectDump = print_r($redirectConfig, true);
431
-            Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__);
431
+            Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__);
432 432
             if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) {
433
-                Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__);
433
+                Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__);
434 434
                 $hasErrors = true;
435 435
             }
436 436
             $rowIndex++;
Please login to merge, or discard this patch.
src/helpers/UrlHelper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         $addSlash = str_ends_with($path, '/');
66 66
         if (!empty($sitePath)) {
67 67
             // Normalizes a URI path by trimming leading/ trailing slashes and removing double slashes
68
-            $sitePath = '/' . preg_replace('/\/\/+/', '/', trim($sitePath, '/'));
68
+            $sitePath = '/'.preg_replace('/\/\/+/', '/', trim($sitePath, '/'));
69 69
         }
70 70
         // Strip the $sitePath from the incoming $path
71 71
         if (str_starts_with($path, $sitePath)) {
72 72
             $path = substr($path, strlen($sitePath));
73
-            $path = '/' . preg_replace('/\/\/+/', '/', trim($path, '/'));
73
+            $path = '/'.preg_replace('/\/\/+/', '/', trim($path, '/'));
74 74
         }
75
-        $path = $addSlash ? $path . '/' : $path;
75
+        $path = $addSlash ? $path.'/' : $path;
76 76
 
77 77
         return $path;
78 78
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $sitePath = parse_url($site->baseUrl, PHP_URL_PATH);
91 91
             if (!empty($sitePath)) {
92 92
                 // Normalizes a URI path by trimming leading/ trailing slashes and removing double slashes
93
-                $sitePath = '/' . preg_replace('/\/\/+/', '/', trim($sitePath, '/'));
93
+                $sitePath = '/'.preg_replace('/\/\/+/', '/', trim($sitePath, '/'));
94 94
             }
95 95
             // Strip the $sitePath from the incoming $path
96 96
             if (str_starts_with($path, $sitePath)) {
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
         $overlap = 0;
114 114
         $url = $url ?? '';
115 115
         $path = $path ?? '';
116
-        $url = rtrim($url, '/') . '/';
117
-        $path = '/' . ltrim($path, '/');
116
+        $url = rtrim($url, '/').'/';
117
+        $path = '/'.ltrim($path, '/');
118 118
         $urlOffset = strlen($url);
119 119
         $pathLength = strlen($path);
120 120
         $pathOffset = 0;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             }
127 127
         }
128 128
 
129
-        return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/');
129
+        return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/');
130 130
     }
131 131
 
132 132
     /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         /** @noinspection CallableParameterUseCaseInTypeContextInspection */
147 147
         $url = preg_replace('/{.*}/', '', $url);
148 148
         // Remove any linebreaks that may be errantly in the URL
149
-        $url = (string)str_replace([
149
+        $url = (string) str_replace([
150 150
                 PHP_EOL,
151 151
                 "\r",
152 152
                 "\n",
Please login to merge, or discard this patch.