Passed
Push — v3 ( 932184...c18a4a )
by Andrew
16:41 queued 09:38
created
src/helpers/Text.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         if (!empty($string)) {
45 45
             $string = strip_tags($string);
46
-            $result = (string)Stringy::create($string)->truncate($length, $substring);
46
+            $result = (string) Stringy::create($string)->truncate($length, $substring);
47 47
         }
48 48
 
49 49
         return $result;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         if (!empty($string)) {
69 69
             $string = strip_tags($string);
70
-            $result = (string)Stringy::create($string)->safeTruncate($length, $substring);
70
+            $result = (string) Stringy::create($string)->safeTruncate($length, $substring);
71 71
         }
72 72
 
73 73
         return $result;
Please login to merge, or discard this patch.
tests/_bootstrap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 ini_set('date.timezone', 'UTC');
6 6
 
7 7
 // Use the current installation of Craft
8
-define('CRAFT_STORAGE_PATH', __DIR__ . '/_craft/storage');
9
-define('CRAFT_TEMPLATES_PATH', __DIR__ . '/_craft/templates');
10
-define('CRAFT_CONFIG_PATH', __DIR__ . '/_craft/config');
11
-define('CRAFT_MIGRATIONS_PATH', __DIR__ . '/_craft/migrations');
12
-define('CRAFT_TRANSLATIONS_PATH', __DIR__ . '/_craft/translations');
13
-define('CRAFT_VENDOR_PATH', dirname(__DIR__) . '/vendor');
8
+define('CRAFT_STORAGE_PATH', __DIR__.'/_craft/storage');
9
+define('CRAFT_TEMPLATES_PATH', __DIR__.'/_craft/templates');
10
+define('CRAFT_CONFIG_PATH', __DIR__.'/_craft/config');
11
+define('CRAFT_MIGRATIONS_PATH', __DIR__.'/_craft/migrations');
12
+define('CRAFT_TRANSLATIONS_PATH', __DIR__.'/_craft/translations');
13
+define('CRAFT_VENDOR_PATH', dirname(__DIR__).'/vendor');
14 14
 define('CRAFT_TESTS_PATH', __DIR__);
15 15
 
16 16
 $devMode = true;
Please login to merge, or discard this patch.
src/services/Events.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
                     if (strcmp($oldUri, $newUri) !== 0) {
103 103
                         // Handle trailing slash config setting
104 104
                         if (Craft::$app->config->general->addTrailingSlashesToUrls) {
105
-                            $oldUri = rtrim($oldUri, '/') . '/';
106
-                            $newUri = rtrim($newUri, '/') . '/';
105
+                            $oldUri = rtrim($oldUri, '/').'/';
106
+                            $newUri = rtrim($newUri, '/').'/';
107 107
                         }
108 108
                         // Handle the URL match type
109 109
                         if (Retour::$settings->uriChangeRedirectSrcMatch === 'fullurl') {
110 110
                             try {
111 111
                                 if ($redirectSiteId !== null) {
112
-                                    $redirectSiteId = (int)$redirectSiteId;
112
+                                    $redirectSiteId = (int) $redirectSiteId;
113 113
                                 }
114 114
                                 $oldUri = \craft\helpers\UrlHelper::siteUrl($oldUri, null, null, $redirectSiteId);
115 115
                                 $newUri = UrlHelper::siteUrl($newUri, null, null, $redirectSiteId);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                             'siteId' => $redirectSiteId,
128 128
                         ];
129 129
                         // Trigger a 'beforeSaveEntryRedirect' event
130
-                        $isNew = (int)$redirectConfig['id'] === 0;
130
+                        $isNew = (int) $redirectConfig['id'] === 0;
131 131
                         $event = new RedirectEvent([
132 132
                             'isNew' => $isNew,
133 133
                             'legacyUrl' => $redirectConfig['redirectSrcUrl'],
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
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function getRecentStatistics($days = 1, $handled = false): array
80 80
     {
81 81
         // Ensure is an int
82
-        $handledInt = (int)$handled;
82
+        $handledInt = (int) $handled;
83 83
         $stats = [];
84 84
         $db = Craft::$app->getDb();
85 85
         if ($db->getIsMysql()) {
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
         $stats->userAgent = $userAgent;
211 211
         $stats->exceptionMessage = $exceptionMessage;
212 212
         $stats->exceptionFilePath = $exceptionFilePath;
213
-        $stats->exceptionFileLine = (int)$exceptionFileLine;
213
+        $stats->exceptionFileLine = (int) $exceptionFileLine;
214 214
         $stats->hitLastTime = Db::prepareDateForDb(new \DateTime());
215
-        $stats->handledByRetour = (int)$handled;
215
+        $stats->handledByRetour = (int) $handled;
216 216
         $stats->hitCount++;
217 217
         $statsConfig = $stats->getAttributes();
218 218
         // Record the updated statistics
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $now = round(microtime(true) * 1000);
357 357
         $cache = Craft::$app->getCache();
358 358
         $then = $cache->get(self::LAST_STATISTICS_TRIM_CACHE_KEY);
359
-        if (($then !== false) && ($now - (int)$then < Retour::$settings->statisticsRateLimitMs)) {
359
+        if (($then !== false) && ($now - (int) $then < Retour::$settings->statisticsRateLimitMs)) {
360 360
             $limited = true;
361 361
         }
362 362
         $cache->set(self::LAST_STATISTICS_TRIM_CACHE_KEY, $now, 0);
Please login to merge, or discard this patch.
src/controllers/ChartsController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                     'COUNT(handledByRetour = 1 or null) as handled_cnt',
82 82
                 ])
83 83
                 ->where("hitLastTime >= ( CURDATE() - INTERVAL '{$days}' DAY )");
84
-            if ((int)$siteId !== 0) {
84
+            if ((int) $siteId !== 0) {
85 85
                 $query->andWhere(['siteId' => $siteId]);
86 86
             }
87 87
             $query
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                     "COUNT(CASE WHEN \"handledByRetour\" = true THEN 1 END) as handled_cnt",
100 100
                 ])
101 101
                 ->where("\"hitLastTime\" >= ( CURRENT_TIMESTAMP - INTERVAL '{$days} days' )");
102
-            if ((int)$siteId !== 0) {
102
+            if ((int) $siteId !== 0) {
103 103
                 $query->andWhere(['siteId' => $siteId]);
104 104
             }
105 105
             $query
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
         }
164 164
         if ($stats) {
165 165
             $data = [
166
-                (int)$stats,
167
-                (int)$handledStats,
166
+                (int) $stats,
167
+                (int) $handledStats,
168 168
             ];
169 169
         }
170 170
 
Please login to merge, or discard this patch.
src/gql/types/generators/RetourGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@
 block discarded – undo
41 41
         $retourType = GqlEntityRegistry::getEntity($typeName)
42 42
             ?: GqlEntityRegistry::createEntity($typeName, new RetourType([
43 43
                 'name' => $typeName,
44
-                'args' => function () use ($retourArgs) {
44
+                'args' => function() use ($retourArgs) {
45 45
                     return $retourArgs;
46 46
                 },
47
-                'fields' => function () use ($retourFields) {
47
+                'fields' => function() use ($retourFields) {
48 48
                     return $retourFields;
49 49
                 },
50 50
                 'description' => 'This entity has all the Retour fields',
51 51
             ]));
52 52
 
53 53
         $gqlTypes[$typeName] = $retourType;
54
-        TypeLoader::registerType($typeName, function () use ($retourType) {
54
+        TypeLoader::registerType($typeName, function() use ($retourType) {
55 55
             return $retourType;
56 56
         });
57 57
 
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
@@ -64,8 +64,8 @@
 block discarded – undo
64 64
             if ($redirect === null && Craft::$app->getElements()->getElementByUri(trim($uri, '/'), $siteId) === null) {
65 65
                 // Set the `site` virtual field
66 66
                 $redirect['site'] = null;
67
-                if (isset($redirect['siteId']) && (int)$redirect['siteId'] !== 0) {
68
-                    $site = Craft::$app->getSites()->getSiteById((int)$redirect['siteId']);
67
+                if (isset($redirect['siteId']) && (int) $redirect['siteId'] !== 0) {
68
+                    $site = Craft::$app->getSites()->getSiteById((int) $redirect['siteId']);
69 69
                     if ($site !== null) {
70 70
                         $redirect['site'] = $site->handle;
71 71
                     }
Please login to merge, or discard this patch.
src/listeners/GetCraftQLSchema.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,36 +62,36 @@
 block discarded – undo
62 62
                 // Boolean field
63 63
                 $retourField
64 64
                     ->addBooleanField($field)
65
-                    ->resolve(function ($redirect) use ($field) {
65
+                    ->resolve(function($redirect) use ($field) {
66 66
                         $result = $redirect[$field] ?? null;
67
-                        return $result === null ? $result : (bool)$result;
67
+                        return $result === null ? $result : (bool) $result;
68 68
                     });
69 69
             } elseif (in_array($field, self::INT_FIELDS, true)) {
70 70
                 // Integer field
71 71
                 $retourField
72 72
                     ->addIntField($field)
73
-                    ->resolve(function ($redirect) use ($field) {
73
+                    ->resolve(function($redirect) use ($field) {
74 74
                         $result = $redirect[$field] ?? null;
75
-                        return $result === null ? $result : (int)$result;
75
+                        return $result === null ? $result : (int) $result;
76 76
                     });
77 77
             } else {
78 78
                 // String field
79 79
                 $retourField
80 80
                     ->addStringField($field)
81
-                    ->resolve(function ($redirect) use ($field) {
81
+                    ->resolve(function($redirect) use ($field) {
82 82
                         $result = $redirect[$field] ?? null;
83
-                        return $result === null ? $result : (string)$result;
83
+                        return $result === null ? $result : (string) $result;
84 84
                     });
85 85
             }
86 86
         }
87 87
         // Add the root
88 88
         $event->schema->addField('retour')
89
-            ->arguments(function (FieldBuilder $field) {
89
+            ->arguments(function(FieldBuilder $field) {
90 90
                 $field->addStringArgument('uri');
91 91
                 $field->addIntArgument('siteId');
92 92
             })
93 93
             ->type($retourField)
94
-            ->resolve(function ($root, $args, $context, $info) {
94
+            ->resolve(function($root, $args, $context, $info) {
95 95
                 // If our root is an Element, extract the URI and siteId from it
96 96
                 if ($root instanceof Element) {
97 97
                     /** Element $root */
Please login to merge, or discard this patch.