Passed
Push — develop ( e8857f...ca73ec )
by Andrew
10:33 queued 03:56
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/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/validators/UriValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
             return;
60 60
         }
61 61
         // Make sure there is a leading /
62
-        $value = '/'.ltrim($value, '/');
62
+        $value = '/' . ltrim($value, '/');
63 63
         $model->$attribute = $value;
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
src/controllers/FileController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     // Protected Properties
62 62
     // =========================================================================
63 63
 
64
-    protected $allowAnonymous = [];
64
+    protected $allowAnonymous = [ ];
65 65
 
66 66
     // Public Methods
67 67
     // =========================================================================
@@ -86,23 +86,23 @@  discard block
 block discarded – undo
86 86
         $headers = array_flip($csv->fetchOne(0));
87 87
         $csv->setOffset(1);
88 88
         $columns = ArrayHelper::filterEmptyStringsFromArray($columns);
89
-        $csv->each(function ($row) use ($headers, $columns) {
89
+        $csv->each(function($row) use ($headers, $columns) {
90 90
             $redirectConfig = [
91 91
                 'id' => 0,
92 92
             ];
93
-            if (isset($columns[0], $headers[$columns[0]])) {
94
-                $redirectConfig['redirectSrcUrl'] = $row[$headers[$columns[0]]] ?? null;
93
+            if (isset($columns[ 0 ], $headers[ $columns[ 0 ] ])) {
94
+                $redirectConfig[ 'redirectSrcUrl' ] = $row[ $headers[ $columns[ 0 ] ] ] ?? null;
95 95
             }
96
-            if (isset($columns[1], $headers[$columns[1]])) {
97
-                $redirectConfig['redirectDestUrl'] = $row[$headers[$columns[1]]] ?? null;
96
+            if (isset($columns[ 1 ], $headers[ $columns[ 1 ] ])) {
97
+                $redirectConfig[ 'redirectDestUrl' ] = $row[ $headers[ $columns[ 1 ] ] ] ?? null;
98 98
             }
99
-            if (isset($columns[2], $headers[$columns[2]])) {
100
-                $redirectConfig['redirectMatchType'] = $row[$headers[$columns[2]]] ?? null;
99
+            if (isset($columns[ 2 ], $headers[ $columns[ 2 ] ])) {
100
+                $redirectConfig[ 'redirectMatchType' ] = $row[ $headers[ $columns[ 2 ] ] ] ?? null;
101 101
             }
102
-            if (isset($columns[3], $headers[$columns[3]])) {
103
-                $redirectConfig['redirectHttpCode'] = $row[$headers[$columns[3]]] ?? null;
102
+            if (isset($columns[ 3 ], $headers[ $columns[ 3 ] ])) {
103
+                $redirectConfig[ 'redirectHttpCode' ] = $row[ $headers[ $columns[ 3 ] ] ] ?? null;
104 104
             }
105
-            Craft::debug('Importing row: '.print_r($redirectConfig, true), __METHOD__);
105
+            Craft::debug('Importing row: ' . print_r($redirectConfig, true), __METHOD__);
106 106
             Retour::$plugin->redirects->saveRedirect($redirectConfig);
107 107
 
108 108
             return true;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function actionImportCsv(string $siteHandle = null): Response
126 126
     {
127
-        $variables = [];
127
+        $variables = [ ];
128 128
         PermissionHelper::controllerPermissionCheck('retour:redirects');
129 129
         // If your CSV document was created or is read on a Macintosh computer,
130 130
         // add the following lines before using the library to help PHP detect line ending in Mac OS X
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
         } catch (InvalidConfigException $e) {
143 143
             Craft::error($e->getMessage(), __METHOD__);
144 144
         }
145
-        $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl(
145
+        $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl(
146 146
             '@nystudio107/retour/assetbundles/retour/dist',
147 147
             true
148 148
         );
149 149
         // Enabled sites
150 150
         MultiSiteHelper::setMultiSiteVariables($siteHandle, $siteId, $variables);
151
-        $variables['controllerHandle'] = 'file';
151
+        $variables[ 'controllerHandle' ] = 'file';
152 152
 
153 153
         // Basic variables
154
-        $variables['fullPageForm'] = true;
155
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
156
-        $variables['pluginName'] = $pluginName;
157
-        $variables['title'] = $templateTitle;
158
-        $variables['crumbs'] = [
154
+        $variables[ 'fullPageForm' ] = true;
155
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
156
+        $variables[ 'pluginName' ] = $pluginName;
157
+        $variables[ 'title' ] = $templateTitle;
158
+        $variables[ 'crumbs' ] = [
159 159
             [
160 160
                 'label' => $pluginName,
161 161
                 'url' => UrlHelper::cpUrl('retour'),
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
                 'url' => UrlHelper::cpUrl('retour/redirects'),
166 166
             ],
167 167
         ];
168
-        $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}";
169
-        $variables['selectedSubnavItem'] = 'redirects';
168
+        $variables[ 'docTitle' ] = "{$pluginName} - Redirects - {$templateTitle}";
169
+        $variables[ 'selectedSubnavItem' ] = 'redirects';
170 170
 
171 171
         // The CSV file
172 172
         $file = UploadedFile::getInstanceByName('file');
173 173
         if ($file !== null) {
174
-            $filename = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.uniqid($file->name, true);
174
+            $filename = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . uniqid($file->name, true);
175 175
             $file->saveAs($filename, false);
176 176
             $csv = Reader::createFromPath($file->tempName);
177 177
             $headers = $csv->fetchOne(0);
178 178
             Craft::info(print_r($headers, true), __METHOD__);
179
-            $variables['headers'] = $headers;
180
-            $variables['filename'] = $filename;
179
+            $variables[ 'headers' ] = $headers;
180
+            $variables[ 'filename' ] = $filename;
181 181
         }
182 182
 
183 183
         // Render the template
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         }
224 224
         // Query the db table
225 225
         $data = (new Query())
226
-            ->from([$table])
226
+            ->from([ $table ])
227 227
             ->select(array_keys($columns))
228 228
             ->orderBy('hitCount DESC')
229 229
             ->all();
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $csv = Writer::createFromFileObject(new \SplTempFileObject());
232 232
         $csv->insertOne(array_values($columns));
233 233
         $csv->insertAll($data);
234
-        $csv->output($filename.'.csv');
234
+        $csv->output($filename . '.csv');
235 235
         exit(0);
236 236
     }
237 237
 }
Please login to merge, or discard this patch.