Passed
Push — develop ( 33b613...f38256 )
by Andrew
26:50 queued 19:03
created
src/gql/queries/RetourQuery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     public static function getQueries($checkToken = true): array
35 35
     {
36 36
         if ($checkToken && !GqlHelper::canQueryRetour()) {
37
-            return [];
37
+            return [ ];
38 38
         }
39 39
 
40 40
         return [
Please login to merge, or discard this patch.
src/controllers/FileController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     // Protected Properties
80 80
     // =========================================================================
81 81
 
82
-    protected $allowAnonymous = [];
82
+    protected $allowAnonymous = [ ];
83 83
 
84 84
     // Public Methods
85 85
     // =========================================================================
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function actionImportCsv(string $siteHandle = null): Response
156 156
     {
157
-        $variables = [];
157
+        $variables = [ ];
158 158
         PermissionHelper::controllerPermissionCheck('retour:redirects');
159 159
         // If your CSV document was created or is read on a Macintosh computer,
160 160
         // add the following lines before using the library to help PHP detect line ending in Mac OS X
@@ -172,38 +172,38 @@  discard block
 block discarded – undo
172 172
         } catch (InvalidConfigException $e) {
173 173
             Craft::error($e->getMessage(), __METHOD__);
174 174
         }
175
-        $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl(
175
+        $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl(
176 176
             '@nystudio107/retour/assetbundles/retour/dist',
177 177
             true
178 178
         );
179 179
         // Enabled sites
180 180
         MultiSiteHelper::setMultiSiteVariables($siteHandle, $siteId, $variables);
181
-        $variables['controllerHandle'] = 'file';
181
+        $variables[ 'controllerHandle' ] = 'file';
182 182
 
183 183
         // Basic variables
184
-        $variables['fullPageForm'] = true;
185
-        $variables['docsUrl'] = self::DOCUMENTATION_URL;
186
-        $variables['pluginName'] = $pluginName;
187
-        $variables['title'] = $templateTitle;
188
-        $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : '';
189
-        $variables['crumbs'] = [
184
+        $variables[ 'fullPageForm' ] = true;
185
+        $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL;
186
+        $variables[ 'pluginName' ] = $pluginName;
187
+        $variables[ 'title' ] = $templateTitle;
188
+        $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : '';
189
+        $variables[ 'crumbs' ] = [
190 190
             [
191 191
                 'label' => $pluginName,
192 192
                 'url' => UrlHelper::cpUrl('retour'),
193 193
             ],
194 194
             [
195 195
                 'label' => 'Redirects',
196
-                'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri),
196
+                'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri),
197 197
             ],
198 198
         ];
199
-        $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}";
200
-        $variables['selectedSubnavItem'] = 'redirects';
199
+        $variables[ 'docTitle' ] = "{$pluginName} - Redirects - {$templateTitle}";
200
+        $variables[ 'selectedSubnavItem' ] = 'redirects';
201 201
 
202 202
         // The CSV file
203 203
         $file = UploadedFile::getInstanceByName('file');
204 204
         if ($file !== null) {
205 205
             $filename = uniqid($file->name, true);
206
-            $filePath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$filename;
206
+            $filePath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $filename;
207 207
             $file->saveAs($filePath, false);
208 208
             // Also save the file to the cache as a backup way to access it
209 209
             $cache = Craft::$app->getCache();
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
             $csv = Reader::createFromPath($file->tempName);
220 220
             $headers = $csv->fetchOne(0);
221 221
             Craft::info(print_r($headers, true), __METHOD__);
222
-            $variables['headers'] = $headers;
223
-            $variables['filename'] = $filePath;
222
+            $variables[ 'headers' ] = $headers;
223
+            $variables[ 'filename' ] = $filePath;
224 224
         }
225 225
 
226 226
         // Render the template
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         }
267 267
         // Query the db table
268 268
         $data = (new Query())
269
-            ->from([$table])
269
+            ->from([ $table ])
270 270
             ->select(array_keys($columns))
271 271
             ->orderBy('hitCount DESC')
272 272
             ->all();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         }
280 280
         $csv->insertOne(array_values($columns));
281 281
         $csv->insertAll($data);
282
-        $csv->output($filename.'.csv');
282
+        $csv->output($filename . '.csv');
283 283
         exit(0);
284 284
     }
285 285
 
@@ -292,16 +292,16 @@  discard block
 block discarded – undo
292 292
     {
293 293
         $csv->setOffset(1);
294 294
         $columns = ArrayHelper::filterEmptyStringsFromArray($columns);
295
-        $csv->each(function ($row) use ($headers, $columns) {
295
+        $csv->each(function($row) use ($headers, $columns) {
296 296
             $redirectConfig = [
297 297
                 'id' => 0,
298 298
             ];
299 299
             $index = 0;
300 300
             foreach (self::IMPORT_REDIRECTS_CSV_FIELDS as $importField) {
301
-                if (isset($columns[$index], $headers[$columns[$index]])) {
302
-                    $redirectConfig[$importField] = empty($row[$headers[$columns[$index]]])
301
+                if (isset($columns[ $index ], $headers[ $columns[ $index ] ])) {
302
+                    $redirectConfig[ $importField ] = empty($row[ $headers[ $columns[ $index ] ] ])
303 303
                         ? null
304
-                        : $row[$headers[$columns[$index]]];
304
+                        : $row[ $headers[ $columns[ $index ] ] ];
305 305
                 }
306 306
                 $index++;
307 307
             }
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
             ];
332 332
             $index = 0;
333 333
             foreach (self::IMPORT_REDIRECTS_CSV_FIELDS as $importField) {
334
-                if (isset($columns[$index], $headers[$columns[$index]])) {
335
-                    $redirectConfig[$importField] = empty($row[$headers[$columns[$index]]])
334
+                if (isset($columns[ $index ], $headers[ $columns[ $index ] ])) {
335
+                    $redirectConfig[ $importField ] = empty($row[ $headers[ $columns[ $index ] ] ])
336 336
                         ? null
337
-                        : $row[$headers[$columns[$index]]];
337
+                        : $row[ $headers[ $columns[ $index ] ] ];
338 338
                 }
339 339
                 $index++;
340 340
             }
Please login to merge, or discard this patch.