Passed
Branch develop (7753b3)
by Andrew
05:34
created
Category
src/controllers/TablesController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $filter = ''
61 61
     ): Response {
62 62
         PermissionHelper::controllerPermissionCheck('retour:dashboard');
63
-        $data = [];
63
+        $data = [ ];
64 64
         $sortField = 'hitCount';
65 65
         $sortType = 'DESC';
66 66
         // Figure out the sorting type
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         // Query the db table
75 75
         $offset = ($page - 1) * $per_page;
76 76
         $query = (new Query())
77
-            ->from(['{{%retour_stats}}'])
77
+            ->from([ '{{%retour_stats}}' ])
78 78
             ->offset($offset)
79 79
             ->limit($per_page)
80 80
             ->orderBy("{$sortField} {$sortType}");
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
         $stats = $query->all();
86 86
         // Add in the `addLink` field
87 87
         foreach ($stats as &$stat) {
88
-            $stat['addLink'] = '';
89
-            if (!$stat['handledByRetour']) {
90
-                $stat['addLink'] = urlencode($stat['redirectSrcUrl']);
88
+            $stat[ 'addLink' ] = '';
89
+            if (!$stat[ 'handledByRetour' ]) {
90
+                $stat[ 'addLink' ] = urlencode($stat[ 'redirectSrcUrl' ]);
91 91
             }
92 92
         }
93 93
         // Format the data for the API
94 94
         if ($stats) {
95
-            $data['data'] = $stats;
95
+            $data[ 'data' ] = $stats;
96 96
             $query = (new Query())
97
-                ->from(['{{%retour_stats}}']);
97
+                ->from([ '{{%retour_stats}}' ]);
98 98
             if ($filter !== '') {
99 99
                 $query->where("`redirectSrcUrl` LIKE '%{$filter}%'");
100 100
                 $query->orWhere("`referrerUrl` LIKE '%{$filter}%'");
101 101
             }
102 102
             $count = $query->count();
103
-            $data['links']['pagination'] = [
103
+            $data[ 'links' ][ 'pagination' ] = [
104 104
                 'total' => $count,
105 105
                 'per_page' => $per_page,
106 106
                 'current_page' => $page,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $filter = ''
134 134
     ): Response {
135 135
         PermissionHelper::controllerPermissionCheck('retour:redirects');
136
-        $data = [];
136
+        $data = [ ];
137 137
         $sortField = 'hitCount';
138 138
         $sortType = 'DESC';
139 139
         // Figure out the sorting type
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         // Query the db table
148 148
         $offset = ($page - 1) * $per_page;
149 149
         $query = (new Query())
150
-            ->from(['{{%retour_static_redirects}}'])
150
+            ->from([ '{{%retour_static_redirects}}' ])
151 151
             ->offset($offset)
152 152
             ->limit($per_page)
153 153
             ->orderBy("{$sortField} {$sortType}");
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
         $redirects = $query->all();
159 159
         // Add in the `deleteLink` field
160 160
         foreach ($redirects as &$redirect) {
161
-            $redirect['deleteLink'] = $redirect['id'];
162
-            $redirect['redirectSrcUrl'].="|{$redirect['id']}";
161
+            $redirect[ 'deleteLink' ] = $redirect[ 'id' ];
162
+            $redirect[ 'redirectSrcUrl' ] .= "|{$redirect[ 'id' ]}";
163 163
         }
164 164
         // Format the data for the API
165 165
         if ($redirects) {
166
-            $data['data'] = $redirects;
166
+            $data[ 'data' ] = $redirects;
167 167
             $query = (new Query())
168
-                ->from(['{{%retour_static_redirects}}']);
168
+                ->from([ '{{%retour_static_redirects}}' ]);
169 169
             if ($filter !== '') {
170 170
                 $query->where("`redirectSrcUrl` LIKE '%{$filter}%'");
171 171
                 $query->orWhere("`redirectDestUrl` LIKE '%{$filter}%'");
172 172
             }
173 173
             $count = $query->count();
174
-            $data['links']['pagination'] = [
174
+            $data[ 'links' ][ 'pagination' ] = [
175 175
                 'total' => $count,
176 176
                 'per_page' => $per_page,
177 177
                 'current_page' => $page,
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
         Craft::error($data);
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/seomatic/assetbundles/seomatic/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/StatisticsController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     // Protected Properties
41 41
     // =========================================================================
42 42
 
43
-    protected $allowAnonymous = [];
43
+    protected $allowAnonymous = [ ];
44 44
 
45 45
     // Public Methods
46 46
     // =========================================================================
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function actionDashboard(string $siteHandle = null, bool $showWelcome = false): Response
58 58
     {
59
-        $variables = [];
59
+        $variables = [ ];
60 60
         PermissionHelper::controllerPermissionCheck('retour:dashboard');
61 61
         // Get the site to edit
62 62
         $siteId = MultiSiteHelper::getSiteIdFromHandle($siteHandle);
@@ -69,20 +69,20 @@  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
         // Enabled sites
77 77
         MultiSiteHelper::setMultiSiteVariables($siteHandle, $siteId, $variables);
78
-        $variables['controllerHandle'] = 'dashboard';
78
+        $variables[ 'controllerHandle' ] = 'dashboard';
79 79
 
80 80
         // Basic variables
81
-        $variables['fullPageForm'] = false;
82
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
83
-        $variables['pluginName'] = $pluginName;
84
-        $variables['title'] = $templateTitle;
85
-        $variables['crumbs'] = [
81
+        $variables[ 'fullPageForm' ] = false;
82
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
83
+        $variables[ 'pluginName' ] = $pluginName;
84
+        $variables[ 'title' ] = $templateTitle;
85
+        $variables[ 'crumbs' ] = [
86 86
             [
87 87
                 'label' => $pluginName,
88 88
                 'url' => UrlHelper::cpUrl('retour'),
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
                 'url' => UrlHelper::cpUrl('retour/dashboard'),
93 93
             ],
94 94
         ];
95
-        $variables['docTitle'] = "{$pluginName} - {$templateTitle}";
96
-        $variables['selectedSubnavItem'] = 'dashboard';
97
-        $variables['showWelcome'] = $showWelcome;
95
+        $variables[ 'docTitle' ] = "{$pluginName} - {$templateTitle}";
96
+        $variables[ 'selectedSubnavItem' ] = 'dashboard';
97
+        $variables[ 'showWelcome' ] = $showWelcome;
98 98
 
99 99
         // Render the template
100 100
         return $this->renderTemplate('retour/dashboard/index', $variables);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             Craft::t(
113 113
                 'retour',
114 114
                 'Retour statistics cleared: {error}',
115
-                ['error' => $error]
115
+                [ 'error' => $error ]
116 116
             ),
117 117
             __METHOD__
118 118
         );
Please login to merge, or discard this patch.
src/services/Redirects.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 Craft::t(
86 86
                     'retour',
87 87
                     '404 URL: {url}',
88
-                    ['url' => $url]
88
+                    [ 'url' => $url ]
89 89
                 ),
90 90
                 __METHOD__
91 91
             );
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $response = Craft::$app->getResponse();
116 116
         if ($redirect !== null) {
117
-            $dest = $redirect['redirectDestUrl'];
118
-            $status = $redirect['redirectHttpCode'];
117
+            $dest = $redirect[ 'redirectDestUrl' ];
118
+            $status = $redirect[ 'redirectHttpCode' ];
119 119
             Craft::info(
120 120
                 Craft::t(
121 121
                     'retour',
122 122
                     'Redirecting {url} to {dest} with status {status}',
123
-                    ['url' => $url, 'dest' => $dest, 'status' => $status]
123
+                    [ 'url' => $url, 'dest' => $dest, 'status' => $status ]
124 124
                 ),
125 125
                 __METHOD__
126 126
             );
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
     public function getRedirectFromCache($url)
173 173
     {
174 174
         $cache = Craft::$app->getCache();
175
-        $cacheKey = $this::CACHE_KEY.md5($url);
175
+        $cacheKey = $this::CACHE_KEY . md5($url);
176 176
         $redirect = $cache->get($cacheKey);
177 177
         Craft::info(
178 178
             Craft::t(
179 179
                 'retour',
180 180
                 'Cached redirect hit for {url}',
181
-                ['url' => $url]
181
+                [ 'url' => $url ]
182 182
             ),
183 183
             __METHOD__
184 184
         );
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function saveRedirectToCache($url, $redirect)
194 194
     {
195
-        $cacheKey = $this::CACHE_KEY.md5($url);
195
+        $cacheKey = $this::CACHE_KEY . md5($url);
196 196
         $cache = Craft::$app->getCache();
197 197
         // Get the current site id
198 198
         $sites = Craft::$app->getSites();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $dependency = new TagDependency([
206 206
             'tags' => [
207 207
                 $this::GLOBAL_REDIRECTS_CACHE_TAG,
208
-                $this::GLOBAL_REDIRECTS_CACHE_TAG.$siteId,
208
+                $this::GLOBAL_REDIRECTS_CACHE_TAG . $siteId,
209 209
             ],
210 210
         ]);
211 211
         $cache->set($cacheKey, $redirect, Retour::$cacheDuration, $dependency);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             Craft::t(
214 214
                 'retour',
215 215
                 'Cached redirect saved for {url}',
216
-                ['url' => $url]
216
+                [ 'url' => $url ]
217 217
             ),
218 218
             __METHOD__
219 219
         );
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
     {
230 230
         $result = null;
231 231
         foreach ($redirects as $redirect) {
232
-            $redirectMatchType = $redirect['redirectMatchType'] ?? null;
232
+            $redirectMatchType = $redirect[ 'redirectMatchType' ] ?? null;
233 233
             switch ($redirectMatchType) {
234 234
                 // Do a straight up match
235 235
                 case 'exactmatch':
236
-                    if (strcasecmp($redirect['redirectSrcUrlParsed'], $url) === 0) {
236
+                    if (strcasecmp($redirect[ 'redirectSrcUrlParsed' ], $url) === 0) {
237 237
                         $this->incrementRedirectHitCount($redirect);
238 238
                         $this->saveRedirectToCache($url, $redirect);
239 239
 
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 
244 244
                 // Do a regex match
245 245
                 case 'regexmatch':
246
-                    $matchRegEx = '`'.$redirect['redirectSrcUrlParsed'].'`i';
246
+                    $matchRegEx = '`' . $redirect[ 'redirectSrcUrlParsed' ] . '`i';
247 247
                     if (preg_match($matchRegEx, $url) === 1) {
248 248
                         $this->incrementRedirectHitCount($redirect);
249 249
                         // If we're not associated with an EntryID, handle capture group replacement
250
-                        if ($redirect['associatedElementId'] === 0) {
251
-                            $redirect['redirectDestUrl'] = preg_replace(
250
+                        if ($redirect[ 'associatedElementId' ] === 0) {
251
+                            $redirect[ 'redirectDestUrl' ] = preg_replace(
252 252
                                 $matchRegEx,
253
-                                $redirect['redirectDestUrl'],
253
+                                $redirect[ 'redirectDestUrl' ],
254 254
                                 $url
255 255
                             );
256 256
                         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                                 'redirect' => &$redirect,
270 270
                             ],
271 271
                         ];
272
-                        $result = \call_user_func_array([$plugin, 'retourMatch'], $args);
272
+                        $result = \call_user_func_array([ $plugin, 'retourMatch' ], $args);
273 273
                         if ($result) {
274 274
                             $this->incrementRedirectHitCount($redirect);
275 275
                             $this->saveRedirectToCache($url, $redirect);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             Craft::t(
285 285
                 'retour',
286 286
                 'Not handled: {url}',
287
-                ['url' => $url]
287
+                [ 'url' => $url ]
288 288
             ),
289 289
             __METHOD__
290 290
         );
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         foreach (Craft::$app->getPlugins()->getAllPlugins() as $plugin) {
309 309
             /** @var Plugin $plugin */
310 310
             if (method_exists($plugin, 'retourMatch')) {
311
-                $result[$plugin->getHandle()] = $plugin->name.Craft::t('retour', ' Match');
311
+                $result[ $plugin->getHandle() ] = $plugin->name . Craft::t('retour', ' Match');
312 312
             }
313 313
         }
314 314
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         }
329 329
         // Query the db table
330 330
         $query = (new Query())
331
-            ->from(['{{%retour_static_redirects}}'])
331
+            ->from([ '{{%retour_static_redirects}}' ])
332 332
             ->orderBy('redirectMatchType ASC, hitCount DESC');
333 333
         if ($limit) {
334 334
             $query->limit($limit);
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
     {
352 352
         // Query the db table
353 353
         $redirect = (new Query())
354
-            ->from(['{{%retour_static_redirects}}'])
355
-            ->where(['id' => $id])
354
+            ->from([ '{{%retour_static_redirects}}' ])
355
+            ->where([ 'id' => $id ])
356 356
             ->one();
357 357
 
358 358
         return $redirect;
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
     public function incrementRedirectHitCount($redirectConfig)
393 393
     {
394 394
         if ($redirectConfig !== null) {
395
-            $redirectConfig['hitCount']++;
396
-            $redirectConfig['hitLastTime'] = Db::prepareDateForDb(new \DateTime());
395
+            $redirectConfig[ 'hitCount' ]++;
396
+            $redirectConfig[ 'hitLastTime' ] = Db::prepareDateForDb(new \DateTime());
397 397
             $this->saveRedirect($redirectConfig);
398 398
         }
399 399
     }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                 Craft::t(
411 411
                     'retour',
412 412
                     'Error validating redirect {id}: {errors}',
413
-                    ['id' => $redirect->id, 'errors' => print_r($redirect->getErrors(), true)]
413
+                    [ 'id' => $redirect->id, 'errors' => print_r($redirect->getErrors(), true) ]
414 414
                 ),
415 415
                 __METHOD__
416 416
             );
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
         // Get the validated model attributes and save them to the db
421 421
         $redirectConfig = $redirect->getAttributes();
422 422
         $db = Craft::$app->getDb();
423
-        if ((int)$redirectConfig['id'] !== 0) {
423
+        if ((int) $redirectConfig[ 'id' ] !== 0) {
424 424
             // Update the existing record
425 425
             try {
426 426
                 $db->createCommand()->update(
427 427
                     '{{%retour_static_redirects}}',
428 428
                     $redirectConfig,
429 429
                     [
430
-                        'id' => $redirectConfig['id'],
430
+                        'id' => $redirectConfig[ 'id' ],
431 431
                     ]
432 432
                 )->execute();
433 433
             } catch (Exception $e) {
Please login to merge, or discard this patch.
src/services/Statistics.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
         // Query the db table
59 59
         $stats = (new Query())
60
-            ->from(['{{%retour_stats}}'])
60
+            ->from([ '{{%retour_stats}}' ])
61 61
             ->orderBy('hitCount DESC')
62 62
             ->limit(Retour::$settings->statsDisplayLimit)
63 63
             ->all();
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
     public function getRecentStatistics($days = 1, $handled = false): array
77 77
     {
78 78
         // Ensure is an int
79
-        $handledInt = (int)$handled;
79
+        $handledInt = (int) $handled;
80 80
         // Query the db table
81 81
         $stats = (new Query())
82
-            ->from(['{{%retour_stats}}'])
82
+            ->from([ '{{%retour_stats}}' ])
83 83
             ->where("hitLastTime >= ( CURDATE() - INTERVAL '{$days}' DAY )")
84 84
             ->andWhere("handledByRetour = {$handledInt}")
85 85
             ->orderBy('hitLastTime DESC')
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
         $stats->validate();
132 132
         // Find any existing retour_stats record
133 133
         $statsConfig = (new Query())
134
-            ->from(['{{%retour_stats}}'])
135
-            ->where(['redirectSrcUrl' => $stats->redirectSrcUrl])
134
+            ->from([ '{{%retour_stats}}' ])
135
+            ->where([ 'redirectSrcUrl' => $stats->redirectSrcUrl ])
136 136
             ->one();
137 137
         // If no record is found, initialize some values
138 138
         if ($statsConfig === null) {
139 139
             $stats->id = 0;
140 140
             $stats->hitCount = 0;
141 141
         } else {
142
-            $stats->id = $statsConfig['id'];
143
-            $stats->hitCount = $statsConfig['hitCount'];
142
+            $stats->id = $statsConfig[ 'id' ];
143
+            $stats->hitCount = $statsConfig[ 'hitCount' ];
144 144
         }
145 145
         // Merge in the updated info
146 146
         $stats->referrerUrl = $referrer;
147 147
         $stats->hitLastTime = Db::prepareDateForDb(new \DateTime());
148
-        $stats->handledByRetour = (int)$handled;
148
+        $stats->handledByRetour = (int) $handled;
149 149
         $stats->hitCount++;
150 150
         $statsConfig = $stats->getAttributes();
151 151
         // Record the updated statistics
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                     Craft::t(
194 194
                         'retour',
195 195
                         'Trimmed {rows} from retour_stats table',
196
-                        ['rows' => $affectedRows]
196
+                        [ 'rows' => $affectedRows ]
197 197
                     ),
198 198
                     __METHOD__
199 199
                 );
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 Craft::t(
214 214
                     'retour',
215 215
                     'Error validating statistics {id}: {errors}',
216
-                    ['id' => $stats->id, 'errors' => print_r($stats->getErrors(), true)]
216
+                    [ 'id' => $stats->id, 'errors' => print_r($stats->getErrors(), true) ]
217 217
                 ),
218 218
                 __METHOD__
219 219
             );
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
         // Get the validated model attributes and save them to the db
224 224
         $statsConfig = $stats->getAttributes();
225 225
         $db = Craft::$app->getDb();
226
-        if ($statsConfig['id'] !== 0) {
226
+        if ($statsConfig[ 'id' ] !== 0) {
227 227
             // Update the existing record
228 228
             try {
229 229
                 $result = $db->createCommand()->update(
230 230
                     '{{%retour_stats}}',
231 231
                     $statsConfig,
232 232
                     [
233
-                        'id' => $statsConfig['id'],
233
+                        'id' => $statsConfig[ 'id' ],
234 234
                     ]
235 235
                 )->execute();
236 236
             } catch (Exception $e) {
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.