Passed
Push — develop ( b6a64d...7bef1a )
by Andrew
04:05
created
src/helpers/Manifest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
         if ($legacyModule === null) {
65 65
             return '';
66 66
         }
67
-        $lines = [];
67
+        $lines = [ ];
68 68
         if ($async) {
69
-            $lines[] = "<link rel=\"preload\" href=\"{$legacyModule}\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\" />";
70
-            $lines[] = "<noscript><link rel=\"stylesheet\" href=\"{$legacyModule}\"></noscript>";
69
+            $lines[ ] = "<link rel=\"preload\" href=\"{$legacyModule}\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\" />";
70
+            $lines[ ] = "<noscript><link rel=\"stylesheet\" href=\"{$legacyModule}\"></noscript>";
71 71
         } else {
72
-            $lines[] = "<link rel=\"stylesheet\" href=\"{$legacyModule}\" />";
72
+            $lines[ ] = "<link rel=\"stylesheet\" href=\"{$legacyModule}\" />";
73 73
         }
74 74
 
75 75
         return implode("\r\n", $lines);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $result = self::getFile($path);
86 86
         if ($result) {
87
-            $result = "<style>\r\n".$result."</style>\r\n";
87
+            $result = "<style>\r\n" . $result . "</style>\r\n";
88 88
             return $result;
89 89
         }
90 90
 
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
                 return '';
128 128
             }
129 129
         }
130
-        $lines = [];
130
+        $lines = [ ];
131 131
         if ($async) {
132
-            $lines[] = "<script type=\"module\" src=\"{$modernModule}\"></script>";
133
-            $lines[] = "<script nomodule src=\"{$legacyModule}\"></script>";
132
+            $lines[ ] = "<script type=\"module\" src=\"{$modernModule}\"></script>";
133
+            $lines[ ] = "<script nomodule src=\"{$legacyModule}\"></script>";
134 134
         } else {
135
-            $lines[] = "<script src=\"{$legacyModule}\"></script>";
135
+            $lines[ ] = "<script src=\"{$legacyModule}\"></script>";
136 136
         }
137 137
 
138 138
         return implode("\r\n", $lines);
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
         $module = self::getModuleEntry($config, $moduleName, $type, $soft);
184 184
         if ($module !== null) {
185 185
             $prefix = self::$isHot
186
-                ? $config['devServer']['publicPath']
187
-                : $config['server']['publicPath'];
186
+                ? $config[ 'devServer' ][ 'publicPath' ]
187
+                : $config[ 'server' ][ 'publicPath' ];
188 188
             // If the module isn't a full URL, prefix it
189 189
             if (!UrlHelper::isAbsoluteUrl($module)) {
190 190
                 $module = self::combinePaths($prefix, $module);
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
         $manifest = self::getManifestFile($config, $type);
226 226
         if ($manifest !== null) {
227 227
             // Make sure it exists in the manifest
228
-            if (empty($manifest[$moduleName])) {
228
+            if (empty($manifest[ $moduleName ])) {
229 229
                 self::reportError(Craft::t(
230 230
                     'retour',
231 231
                     'Module does not exist in the manifest: {moduleName}',
232
-                    ['moduleName' => $moduleName]
232
+                    [ 'moduleName' => $moduleName ]
233 233
                 ), $soft);
234 234
 
235 235
                 return null;
236 236
             }
237
-            $module = $manifest[$moduleName];
237
+            $module = $manifest[ $moduleName ];
238 238
         }
239 239
 
240 240
         return $module;
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
         $manifest = null;
255 255
         // Determine whether we should use the devServer for HMR or not
256 256
         $devMode = Craft::$app->getConfig()->getGeneral()->devMode;
257
-        self::$isHot = ($devMode && $config['useDevServer']);
257
+        self::$isHot = ($devMode && $config[ 'useDevServer' ]);
258 258
         // Try to get the manifest
259 259
         while ($manifest === null) {
260 260
             $manifestPath = self::$isHot
261
-                ? $config['devServer']['manifestPath']
262
-                : $config['server']['manifestPath'];
261
+                ? $config[ 'devServer' ][ 'manifestPath' ]
262
+                : $config[ 'server' ][ 'manifestPath' ];
263 263
             // Normalize the path
264
-            $path = self::combinePaths($manifestPath, $config['manifest'][$type]);
264
+            $path = self::combinePaths($manifestPath, $config[ 'manifest' ][ $type ]);
265 265
             $manifest = self::getJsonFile($path);
266 266
             // If the manifest isn't found, and it was hot, fall back on non-hot
267 267
             if ($manifest === null) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                 self::reportError(Craft::t(
270 270
                     'retour',
271 271
                     'Manifest file not found at: {manifestPath}',
272
-                    ['manifestPath' => $manifestPath]
272
+                    [ 'manifestPath' => $manifestPath ]
273 273
                 ), true);
274 274
                 if (self::$isHot) {
275 275
                     // Try again, but not with home module replacement
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         }
313 313
         if ($path !== null) {
314 314
             $path = self::combinePaths(
315
-                $config['localFiles']['basePath'],
315
+                $config[ 'localFiles' ][ 'basePath' ],
316 316
                 $path
317 317
             );
318 318
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      */
332 332
     protected static function getJsonFile(string $path)
333 333
     {
334
-        return self::getFileFromUri($path, [self::class, 'jsonFileDecode']);
334
+        return self::getFileFromUri($path, [ self::class, 'jsonFileDecode' ]);
335 335
     }
336 336
 
337 337
     /**
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
     protected static function getFileContents(string $path, callable $callback = null)
386 386
     {
387 387
         // Return the memoized manifest if it exists
388
-        if (!empty(self::$files[$path])) {
389
-            return self::$files[$path];
388
+        if (!empty(self::$files[ $path ])) {
389
+            return self::$files[ $path ];
390 390
         }
391 391
         // Create the dependency tags
392 392
         $dependency = new TagDependency([
393 393
             'tags' => [
394 394
                 self::CACHE_TAG,
395
-                self::CACHE_TAG.$path,
395
+                self::CACHE_TAG . $path,
396 396
             ],
397 397
         ]);
398 398
         // Set the cache duration based on devMode
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
         // Get the result from the cache, or parse the file
403 403
         $cache = Craft::$app->getCache();
404 404
         $file = $cache->getOrSet(
405
-            self::CACHE_KEY.$path,
406
-            function () use ($path, $callback) {
405
+            self::CACHE_KEY . $path,
406
+            function() use ($path, $callback) {
407 407
                 $result = null;
408 408
                 $contents = @file_get_contents($path);
409 409
                 if ($contents) {
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
             $cacheDuration,
419 419
             $dependency
420 420
         );
421
-        self::$files[$path] = $file;
421
+        self::$files[ $path ] = $file;
422 422
 
423 423
         return $file;
424 424
     }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     protected static function combinePaths(string ...$paths): string
434 434
     {
435 435
         $last_key = \count($paths) - 1;
436
-        array_walk($paths, function (&$val, $key) use ($last_key) {
436
+        array_walk($paths, function(&$val, $key) use ($last_key) {
437 437
             switch ($key) {
438 438
                 case 0:
439 439
                     $val = rtrim($val, '/ ');
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
         $last = array_pop($paths);
452 452
         $paths = array_filter($paths);
453 453
         array_unshift($paths, $first);
454
-        $paths[] = $last;
454
+        $paths[ ] = $last;
455 455
 
456 456
         return implode('/', $paths);
457 457
     }
Please login to merge, or discard this patch.
src/variables/ManifestVariable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
     {
44 44
         ManifestHelper::invalidateCaches();
45 45
         $bundle = new RetourAsset();
46
-        self::$config['server']['manifestPath'] = Craft::getAlias($bundle->sourcePath);
46
+        self::$config[ 'server' ][ 'manifestPath' ] = Craft::getAlias($bundle->sourcePath);
47 47
         $useDevServer = getenv('NYS_PLUGIN_DEVSERVER');
48 48
         if ($useDevServer !== false) {
49
-            self::$config['useDevServer'] = (bool)$useDevServer;
49
+            self::$config[ 'useDevServer' ] = (bool) $useDevServer;
50 50
         }
51 51
     }
52 52
 
Please login to merge, or discard this patch.