Passed
Push — develop ( f33634...8a6449 )
by Andrew
04:16
created
src/models/DbModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         foreach ($config as $propName => $propValue) {
38 38
             if (!property_exists($class, $propName)) {
39
-                unset($config[$propName]);
39
+                unset($config[ $propName ]);
40 40
             }
41 41
         }
42 42
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     /**
48 48
      * @inheritdoc
49 49
      */
50
-    public function __construct(array $config = [])
50
+    public function __construct(array $config = [ ])
51 51
     {
52 52
         // Unset any deprecated properties
53 53
         self::cleanProperties(static::class, $config);
Please login to merge, or discard this patch.
src/models/Settings.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
     public function rules()
76 76
     {
77 77
         return [
78
-            ['pluginName', 'string'],
79
-            ['pluginName', 'default', 'value' => 'Retour'],
78
+            [ 'pluginName', 'string' ],
79
+            [ 'pluginName', 'default', 'value' => 'Retour' ],
80 80
             [
81 81
                 [
82 82
                     'createUriChangeRedirects',
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
                 ],
86 86
                 'boolean'
87 87
             ],
88
-            ['staticRedirectDisplayLimit', 'integer', 'min' => 1],
89
-            ['staticRedirectDisplayLimit', 'default', 'value' => 100],
90
-            ['dynamicRedirectDisplayLimit', 'integer', 'min' => 1],
91
-            ['dynamicRedirectDisplayLimit', 'default', 'value' => 100],
92
-            ['statsStoredLimit', 'integer', 'min' => 1],
93
-            ['statsStoredLimit', 'default', 'value' => 1000],
94
-            ['statsDisplayLimit', 'integer', 'min' => 1],
95
-            ['statsDisplayLimit', 'default', 'value' => 1000],
88
+            [ 'staticRedirectDisplayLimit', 'integer', 'min' => 1 ],
89
+            [ 'staticRedirectDisplayLimit', 'default', 'value' => 100 ],
90
+            [ 'dynamicRedirectDisplayLimit', 'integer', 'min' => 1 ],
91
+            [ 'dynamicRedirectDisplayLimit', 'default', 'value' => 100 ],
92
+            [ 'statsStoredLimit', 'integer', 'min' => 1 ],
93
+            [ 'statsStoredLimit', 'default', 'value' => 1000 ],
94
+            [ 'statsDisplayLimit', 'integer', 'min' => 1 ],
95
+            [ 'statsDisplayLimit', 'default', 'value' => 1000 ],
96 96
         ];
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
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.
src/helpers/MultiSite.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,43 +42,43 @@  discard block
 block discarded – undo
42 42
         $sites = Craft::$app->getSites();
43 43
         if (Craft::$app->getIsMultiSite()) {
44 44
             // Set defaults based on the section settings
45
-            $variables['enabledSiteIds'] = [];
46
-            $variables['siteIds'] = [];
45
+            $variables[ 'enabledSiteIds' ] = [ ];
46
+            $variables[ 'siteIds' ] = [ ];
47 47
 
48 48
             /** @var Site $site */
49 49
             foreach ($sites->getEditableSiteIds() as $editableSiteId) {
50
-                $variables['enabledSiteIds'][] = $editableSiteId;
51
-                $variables['siteIds'][] = $editableSiteId;
50
+                $variables[ 'enabledSiteIds' ][ ] = $editableSiteId;
51
+                $variables[ 'siteIds' ][ ] = $editableSiteId;
52 52
             }
53 53
 
54 54
             // Make sure the $siteId they are trying to edit is in our array of editable sites
55
-            if (!\in_array($siteId, $variables['enabledSiteIds'], false)) {
56
-                if (!empty($variables['enabledSiteIds'])) {
57
-                    $siteId = reset($variables['enabledSiteIds']);
55
+            if (!\in_array($siteId, $variables[ 'enabledSiteIds' ], false)) {
56
+                if (!empty($variables[ 'enabledSiteIds' ])) {
57
+                    $siteId = reset($variables[ 'enabledSiteIds' ]);
58 58
                 } else {
59
-                    self::requirePermission('editSite:'.$siteId);
59
+                    self::requirePermission('editSite:' . $siteId);
60 60
                 }
61 61
             }
62 62
         }
63 63
         // Set the currentSiteId and currentSiteHandle
64
-        $variables['currentSiteId'] = empty($siteId) ? Craft::$app->getSites()->currentSite->id : $siteId;
65
-        $variables['currentSiteHandle'] = empty($siteHandle)
64
+        $variables[ 'currentSiteId' ] = empty($siteId) ? Craft::$app->getSites()->currentSite->id : $siteId;
65
+        $variables[ 'currentSiteHandle' ] = empty($siteHandle)
66 66
             ? Craft::$app->getSites()->currentSite->handle
67 67
             : $siteHandle;
68 68
 
69 69
         // Page title
70
-        $variables['showSites'] = (
70
+        $variables[ 'showSites' ] = (
71 71
             Craft::$app->getIsMultiSite() &&
72
-            \count($variables['enabledSiteIds'])
72
+            \count($variables[ 'enabledSiteIds' ])
73 73
         );
74 74
 
75
-        if ($variables['showSites']) {
76
-            $variables['sitesMenuLabel'] = Craft::t(
75
+        if ($variables[ 'showSites' ]) {
76
+            $variables[ 'sitesMenuLabel' ] = Craft::t(
77 77
                 'site',
78
-                $sites->getSiteById((int)$variables['currentSiteId'])->name
78
+                $sites->getSiteById((int) $variables[ 'currentSiteId' ])->name
79 79
             );
80 80
         } else {
81
-            $variables['sitesMenuLabel'] = '';
81
+            $variables[ 'sitesMenuLabel' ] = '';
82 82
         }
83 83
     }
84 84
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         if ($siteHandle !== null) {
97 97
             $site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
98 98
             if (!$site) {
99
-                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle);
99
+                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle);
100 100
             }
101 101
             $siteId = $site->id;
102 102
         } else {
Please login to merge, or discard this patch.
src/widgets/RetourWidget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@
 block discarded – undo
78 78
         $rules = array_merge(
79 79
             $rules,
80 80
             [
81
-                ['numberOfDays', 'integer', 'min' => 1],
82
-                ['numberOfDays', 'default', 'value' => 30],
81
+                [ 'numberOfDays', 'integer', 'min' => 1 ],
82
+                [ 'numberOfDays', 'default', 'value' => 30 ],
83 83
             ]
84 84
         );
85 85
         return $rules;
Please login to merge, or discard this patch.
src/controllers/SettingsController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     // Protected Properties
40 40
     // =========================================================================
41 41
 
42
-    protected $allowAnonymous = [];
42
+    protected $allowAnonymous = [ ];
43 43
 
44 44
     // Public Methods
45 45
     // =========================================================================
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function actionPluginSettings($settings = null): Response
56 56
     {
57
-        $variables = [];
57
+        $variables = [ ];
58 58
         PermissionHelper::controllerPermissionCheck('retour:settings');
59 59
         if ($settings === null) {
60 60
             $settings = Retour::$settings;
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
         } catch (InvalidConfigException $e) {
70 70
             Craft::error($e->getMessage(), __METHOD__);
71 71
         }
72
-        $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl(
72
+        $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl(
73 73
             '@nystudio107/retour/assetbundles/retour/dist',
74 74
             true
75 75
         );
76 76
         // Basic variables
77
-        $variables['fullPageForm'] = true;
78
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
79
-        $variables['pluginName'] = $pluginName;
80
-        $variables['title'] = $templateTitle;
81
-        $variables['crumbs'] = [
77
+        $variables[ 'fullPageForm' ] = true;
78
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
79
+        $variables[ 'pluginName' ] = $pluginName;
80
+        $variables[ 'title' ] = $templateTitle;
81
+        $variables[ 'crumbs' ] = [
82 82
             [
83 83
                 'label' => $pluginName,
84 84
                 'url' => UrlHelper::cpUrl('retour'),
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
                 'url' => UrlHelper::cpUrl('retour/settings'),
89 89
             ],
90 90
         ];
91
-        $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
92
-        $variables['selectedSubnavItem'] = 'settings';
93
-        $variables['settings'] = $settings;
91
+        $variables[ 'docTitle' ] = "{$pluginName} - {$templateTitle}";
92
+        $variables[ 'selectedSubnavItem' ] = 'settings';
93
+        $variables[ 'settings' ] = $settings;
94 94
 
95 95
         // Render the template
96 96
         return $this->renderTemplate('retour/settings', $variables);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         PermissionHelper::controllerPermissionCheck('retour:settings');
111 111
         $this->requirePostRequest();
112 112
         $pluginHandle = Craft::$app->getRequest()->getRequiredBodyParam('pluginHandle');
113
-        $settings = Craft::$app->getRequest()->getBodyParam('settings', []);
113
+        $settings = Craft::$app->getRequest()->getBodyParam('settings', [ ]);
114 114
         $plugin = Craft::$app->getPlugins()->getPlugin($pluginHandle);
115 115
 
116 116
         if ($plugin === null) {
Please login to merge, or discard this patch.
src/controllers/ChartsController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function actionDashboard(string $range = 'day'): Response
55 55
     {
56 56
         PermissionHelper::controllerPermissionCheck('retour:dashboard');
57
-        $data = [];
57
+        $data = [ ];
58 58
         $days = 1;
59 59
         switch ($range) {
60 60
             case 'day':
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
             ->groupBy('DAY(hitLastTime)')
81 81
             ->all();
82 82
         if ($stats) {
83
-            $data[] = [
83
+            $data[ ] = [
84 84
                 'name' => '404 hits',
85 85
                 'data' => ArrayHelper::getColumn($stats, 'cnt'),
86 86
                 'labels' => ArrayHelper::getColumn($stats, 'hitLastTime'),
87 87
             ];
88
-            $data[] = [
88
+            $data[ ] = [
89 89
                 'name' => 'Handled 404 hits',
90 90
                 'data' => ArrayHelper::getColumn($stats, 'handled_cnt'),
91 91
                 'labels' => ArrayHelper::getColumn($stats, 'hitLastTime'),
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function actionWidget($days = 1): Response
106 106
     {
107
-        $data = [];
107
+        $data = [ ];
108 108
         // Query the db
109 109
         $stats = (new Query())
110 110
             ->from('{{%retour_stats}}')
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
             ->count();
118 118
         if ($stats) {
119 119
             $data = [
120
-                (int)$stats,
121
-                (int)$handledStats
120
+                (int) $stats,
121
+                (int) $handledStats
122 122
             ];
123 123
         }
124 124
 
Please login to merge, or discard this patch.
src/controllers/RedirectsController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     // Protected Properties
42 42
     // =========================================================================
43 43
 
44
-    protected $allowAnonymous = [];
44
+    protected $allowAnonymous = [ ];
45 45
 
46 46
     // Public Methods
47 47
     // =========================================================================
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function actionRedirects(string $siteHandle = null): Response
59 59
     {
60
-        $variables = [];
60
+        $variables = [ ];
61 61
         PermissionHelper::controllerPermissionCheck('retour:redirects');
62 62
         // Get the site to edit
63 63
         $siteId = MultiSiteHelper::getSiteIdFromHandle($siteHandle);
@@ -70,20 +70,20 @@  discard block
 block discarded – undo
70 70
         } catch (InvalidConfigException $e) {
71 71
             Craft::error($e->getMessage(), __METHOD__);
72 72
         }
73
-        $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl(
73
+        $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl(
74 74
             '@nystudio107/retour/assetbundles/retour/dist',
75 75
             true
76 76
         );
77 77
         // Enabled sites
78 78
         MultiSiteHelper::setMultiSiteVariables($siteHandle, $siteId, $variables);
79
-        $variables['controllerHandle'] = 'redirects';
79
+        $variables[ 'controllerHandle' ] = 'redirects';
80 80
 
81 81
         // Basic variables
82
-        $variables['fullPageForm'] = false;
83
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
84
-        $variables['pluginName'] = $pluginName;
85
-        $variables['title'] = $templateTitle;
86
-        $variables['crumbs'] = [
82
+        $variables[ 'fullPageForm' ] = false;
83
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
84
+        $variables[ 'pluginName' ] = $pluginName;
85
+        $variables[ 'title' ] = $templateTitle;
86
+        $variables[ 'crumbs' ] = [
87 87
             [
88 88
                 'label' => $pluginName,
89 89
                 'url' => UrlHelper::cpUrl('retour'),
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
                 'url' => UrlHelper::cpUrl('retour/redirects'),
94 94
             ],
95 95
         ];
96
-        $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
97
-        $variables['selectedSubnavItem'] = 'redirects';
96
+        $variables[ 'docTitle' ] = "{$pluginName} - {$templateTitle}";
97
+        $variables[ 'selectedSubnavItem' ] = 'redirects';
98 98
 
99 99
         // Render the template
100 100
         return $this->renderTemplate('retour/redirects/index', $variables);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         string $siteHandle = null,
119 119
         StaticRedirectsModel $redirect = null
120 120
     ): Response {
121
-        $variables = [];
121
+        $variables = [ ];
122 122
         PermissionHelper::controllerPermissionCheck('retour:redirects');
123 123
         // Load in the redirect
124 124
         if ($redirectId === 0) {
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
         if ($redirect === null) {
131 131
             $redirectConfig = Retour::$plugin->redirects->getRedirectById($redirectId);
132 132
             if ($redirectConfig === null) {
133
-                $redirectConfig = [];
133
+                $redirectConfig = [ ];
134 134
                 Craft::error(
135 135
                     Craft::t(
136 136
                         'retour',
137 137
                         "Couldn't load redirect id {id}",
138
-                        ['id' => $redirectId]
138
+                        [ 'id' => $redirectId ]
139 139
                     ),
140 140
                     __METHOD__
141 141
                 );
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
         } catch (InvalidConfigException $e) {
154 154
             Craft::error($e->getMessage(), __METHOD__);
155 155
         }
156
-        $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl(
156
+        $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl(
157 157
             '@nystudio107/retour/assetbundles/retour/dist',
158 158
             true
159 159
         );
160 160
         // Enabled sites
161 161
         MultiSiteHelper::setMultiSiteVariables($siteHandle, $siteId, $variables);
162
-        $variables['controllerHandle'] = 'redirects';
162
+        $variables[ 'controllerHandle' ] = 'redirects';
163 163
 
164 164
         // Basic variables
165
-        $variables['fullPageForm'] = true;
166
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
167
-        $variables['pluginName'] = $pluginName;
168
-        $variables['title'] = $templateTitle;
169
-        $variables['crumbs'] = [
165
+        $variables[ 'fullPageForm' ] = true;
166
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
167
+        $variables[ 'pluginName' ] = $pluginName;
168
+        $variables[ 'title' ] = $templateTitle;
169
+        $variables[ 'crumbs' ] = [
170 170
             [
171 171
                 'label' => $pluginName,
172 172
                 'url' => UrlHelper::cpUrl('retour'),
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
             ],
178 178
             [
179 179
                 'label' => $templateTitle,
180
-                'url' => UrlHelper::cpUrl('retour/edit-redirect/'.$redirectId),
180
+                'url' => UrlHelper::cpUrl('retour/edit-redirect/' . $redirectId),
181 181
             ],
182 182
         ];
183
-        $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}";
184
-        $variables['selectedSubnavItem'] = 'redirects';
185
-        $variables['redirect'] = $redirect;
183
+        $variables[ 'docTitle' ] = "{$pluginName} - Redirects - {$templateTitle}";
184
+        $variables[ 'selectedSubnavItem' ] = 'redirects';
185
+        $variables[ 'redirect' ] = $redirect;
186 186
 
187 187
         // Render the template
188 188
         return $this->renderTemplate('retour/redirects/_edit', $variables);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         if ($redirectConfig === null) {
229 229
             throw new NotFoundHttpException('Redirect not found');
230 230
         }
231
-        $redirectConfig['id'] = (int)$redirectConfig['id'];
231
+        $redirectConfig[ 'id' ] = (int) $redirectConfig[ 'id' ];
232 232
         $redirect = new StaticRedirectsModel($redirectConfig);
233 233
         // Make sure the redirect validates
234 234
         if (!$redirect->validate()) {
Please login to merge, or discard this patch.
src/models/StaticRedirects.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
     public function rules()
85 85
     {
86 86
         return [
87
-            ['id', 'integer'],
88
-            ['locale', DbStringValidator::class, 'max' => 12],
89
-            ['locale', 'string'],
90
-            ['locale', 'default', 'value' => ''],
91
-            ['associatedElementId', 'default', 'value' => 0],
92
-            ['associatedElementId', 'integer'],
87
+            [ 'id', 'integer' ],
88
+            [ 'locale', DbStringValidator::class, 'max' => 12 ],
89
+            [ 'locale', 'string' ],
90
+            [ 'locale', 'default', 'value' => '' ],
91
+            [ 'associatedElementId', 'default', 'value' => 0 ],
92
+            [ 'associatedElementId', 'integer' ],
93 93
             [
94 94
                 [
95 95
                     'redirectSrcUrl',
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
                 'default',
100 100
                 'value' => ''
101 101
             ],
102
-            ['redirectMatchType', 'default', 'value' => 'exactmatch'],
103
-            ['redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl'],
102
+            [ 'redirectMatchType', 'default', 'value' => 'exactmatch' ],
103
+            [ 'redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl' ],
104 104
             [
105 105
                 [
106 106
                     'redirectSrcUrl',
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
                 ],
129 129
                 'string'
130 130
             ],
131
-            ['redirectHttpCode', 'integer'],
132
-            ['redirectHttpCode', 'default', 'value' => 301],
133
-            ['hitCount', 'default', 'value' => 0],
134
-            ['hitCount', 'integer'],
135
-            ['hitLastTime', 'safe'],
131
+            [ 'redirectHttpCode', 'integer' ],
132
+            [ 'redirectHttpCode', 'default', 'value' => 301 ],
133
+            [ 'hitCount', 'default', 'value' => 0 ],
134
+            [ 'hitCount', 'integer' ],
135
+            [ 'hitLastTime', 'safe' ],
136 136
         ];
137 137
     }
138 138
 }
Please login to merge, or discard this patch.