Passed
Push — v3 ( 7e70fb...204d12 )
by Andrew
20:47 queued 11:42
created
src/controllers/RedirectsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         if ($redirectConfig === null) {
252 252
             throw new NotFoundHttpException('Redirect not found');
253 253
         }
254
-        $redirectConfig['id'] = (int)$redirectConfig['id'];
254
+        $redirectConfig['id'] = (int) $redirectConfig['id'];
255 255
         // Handle enforcing trailing slashes
256 256
         $generalConfig = Craft::$app->getConfig()->getGeneral();
257 257
         if ($generalConfig->addTrailingSlashesToUrls && $redirectConfig['redirectMatchType'] === 'exactmatch') {
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
         if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false) {
315 315
             // If it's a root relative URL, assume it's a site URL
316 316
             if (UrlHelper::isRootRelativeUrl($url)) {
317
-                return rtrim($url, '/') . '/';
317
+                return rtrim($url, '/').'/';
318 318
             }
319 319
             // If the URL matches any of the site's base URLs, assume it's a site URL
320 320
             $sites = Craft::$app->getSites()->getAllSites();
321 321
             foreach ($sites as $site) {
322 322
                 if (strpos($url, $site->getBaseUrl()) === 0) {
323
-                    return rtrim($url, '/') . '/';
323
+                    return rtrim($url, '/').'/';
324 324
                 }
325 325
             }
326 326
         }
Please login to merge, or discard this patch.
src/controllers/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     {
300 300
         $csv->setOffset(1);
301 301
         $columns = ArrayHelper::filterEmptyStringsFromArray($columns);
302
-        $csv->each(function ($row) use ($headers, $columns) {
302
+        $csv->each(function($row) use ($headers, $columns) {
303 303
             $redirectConfig = [
304 304
                 'id' => 0,
305 305
             ];
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                 }
313 313
                 $index++;
314 314
             }
315
-            Craft::debug('Importing row: ' . print_r($redirectConfig, true), __METHOD__);
315
+            Craft::debug('Importing row: '.print_r($redirectConfig, true), __METHOD__);
316 316
             Retour::$plugin->redirects->saveRedirect($redirectConfig);
317 317
 
318 318
             return true;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                 }
346 346
                 $index++;
347 347
             }
348
-            Craft::debug('Importing row: ' . print_r($redirectConfig, true), __METHOD__);
348
+            Craft::debug('Importing row: '.print_r($redirectConfig, true), __METHOD__);
349 349
             Retour::$plugin->redirects->saveRedirect($redirectConfig);
350 350
         }
351 351
     }
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/interfaces/RetourInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             'name' => static::getName(),
51 51
             'fields' => self::class.'::getFieldDefinitions',
52 52
             'description' => 'This is the interface implemented by Retour.',
53
-            'resolveType' => function (array $value) {
53
+            'resolveType' => function(array $value) {
54 54
                 return GqlEntityRegistry::getEntity(RetourGenerator::getName());
55 55
             },
56 56
         ]));
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.
src/Retour.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         Event::on(
308 308
             ClearCaches::class,
309 309
             ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
310
-            function (RegisterCacheOptionsEvent $event) {
310
+            function(RegisterCacheOptionsEvent $event) {
311 311
                 Craft::debug(
312 312
                     'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS',
313 313
                     __METHOD__
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         Event::on(
324 324
             Plugins::class,
325 325
             Plugins::EVENT_AFTER_INSTALL_PLUGIN,
326
-            function (PluginEvent $event) {
326
+            function(PluginEvent $event) {
327 327
                 if ($event->plugin === $this) {
328 328
                     // Invalidate our caches after we've been installed
329 329
                     $this->clearAllCaches();
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         Event::on(
351 351
             CraftVariable::class,
352 352
             CraftVariable::EVENT_INIT,
353
-            function (Event $event) {
353
+            function(Event $event) {
354 354
                 /** @var CraftVariable $variable */
355 355
                 $variable = $event->sender;
356 356
                 $variable->set('retour', [
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
         Event::on(
364 364
             Elements::class,
365 365
             Elements::EVENT_BEFORE_SAVE_ELEMENT,
366
-            function (ElementEvent $event) {
366
+            function(ElementEvent $event) {
367 367
                 Craft::debug(
368 368
                     'Elements::EVENT_BEFORE_SAVE_ELEMENT',
369 369
                     __METHOD__
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         Event::on(
395 395
             Elements::class,
396 396
             Elements::EVENT_AFTER_SAVE_ELEMENT,
397
-            function (ElementEvent $event) {
397
+            function(ElementEvent $event) {
398 398
                 Craft::debug(
399 399
                     'Elements::EVENT_AFTER_SAVE_ELEMENT',
400 400
                     __METHOD__
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         Event::on(
417 417
             Plugins::class,
418 418
             Plugins::EVENT_AFTER_LOAD_PLUGINS,
419
-            function () {
419
+            function() {
420 420
                 // Install these only after all other plugins have loaded
421 421
                 $request = Craft::$app->getRequest();
422 422
                 // Only respond to non-console site requests
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             Event::on(
435 435
                 Gql::class,
436 436
                 Gql::EVENT_REGISTER_GQL_TYPES,
437
-                function (RegisterGqlTypesEvent $event) {
437
+                function(RegisterGqlTypesEvent $event) {
438 438
                     Craft::debug(
439 439
                         'Gql::EVENT_REGISTER_GQL_TYPES',
440 440
                         __METHOD__
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             Event::on(
447 447
                 Gql::class,
448 448
                 Gql::EVENT_REGISTER_GQL_QUERIES,
449
-                function (RegisterGqlQueriesEvent $event) {
449
+                function(RegisterGqlQueriesEvent $event) {
450 450
                     Craft::debug(
451 451
                         'Gql::EVENT_REGISTER_GQL_QUERIES',
452 452
                         __METHOD__
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                 Event::on(
463 463
                     Gql::class,
464 464
                     Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS,
465
-                    function (RegisterGqlSchemaComponentsEvent $event) {
465
+                    function(RegisterGqlSchemaComponentsEvent $event) {
466 466
                         Craft::debug(
467 467
                             'Gql::EVENT_REGISTER_GQL_SCHEMA_COMPONENTS',
468 468
                             __METHOD__
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         Event::on(
493 493
             UrlManager::class,
494 494
             UrlManager::EVENT_REGISTER_SITE_URL_RULES,
495
-            function (RegisterUrlRulesEvent $event) {
495
+            function(RegisterUrlRulesEvent $event) {
496 496
                 Craft::debug(
497 497
                     'UrlManager::EVENT_REGISTER_SITE_URL_RULES',
498 498
                     __METHOD__
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         Event::on(
516 516
             Dashboard::class,
517 517
             Dashboard::EVENT_REGISTER_WIDGET_TYPES,
518
-            function (RegisterComponentTypesEvent $event) {
518
+            function(RegisterComponentTypesEvent $event) {
519 519
                 $event->types[] = RetourWidget::class;
520 520
             }
521 521
         );
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         Event::on(
524 524
             UrlManager::class,
525 525
             UrlManager::EVENT_REGISTER_CP_URL_RULES,
526
-            function (RegisterUrlRulesEvent $event) {
526
+            function(RegisterUrlRulesEvent $event) {
527 527
                 Craft::debug(
528 528
                     'UrlManager::EVENT_REGISTER_CP_URL_RULES',
529 529
                     __METHOD__
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
         Event::on(
540 540
             UserPermissions::class,
541 541
             UserPermissions::EVENT_REGISTER_PERMISSIONS,
542
-            function (RegisterUserPermissionsEvent $event) {
542
+            function(RegisterUserPermissionsEvent $event) {
543 543
                 Craft::debug(
544 544
                     'UserPermissions::EVENT_REGISTER_PERMISSIONS',
545 545
                     __METHOD__
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
         Event::on(
562 562
             ErrorHandler::class,
563 563
             ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION,
564
-            function (ExceptionEvent $event) {
564
+            function(ExceptionEvent $event) {
565 565
                 Craft::debug(
566 566
                     'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION',
567 567
                     __METHOD__
Please login to merge, or discard this patch.