Completed
Pull Request — master (#1811)
by
unknown
06:50
created
src/Commands/Publish/PublishCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $module = $this->getModuleModel($name);
26 26
 
27
-        $this->components->task("Publishing Assets <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
27
+        $this->components->task("Publishing Assets <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) {
28 28
             with(new AssetPublisher($module))
29 29
                 ->setRepository($this->laravel['modules'])
30 30
                 ->setConsole($this)
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     }
35 35
 
36
-    public function getInfo(): string|null
36
+    public function getInfo(): string | null
37 37
     {
38 38
         return 'Publishing module asset files ...';
39 39
     }
Please login to merge, or discard this patch.
src/Generators/ModuleGenerator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 continue;
360 360
             }
361 361
 
362
-            $path = $this->module->getModulePath($this->getName()) . '/' . $folder->getPath();
362
+            $path = $this->module->getModulePath($this->getName()).'/'.$folder->getPath();
363 363
 
364 364
             $this->filesystem->ensureDirectoryExists($path, 0755, true);
365 365
             if (config('modules.stubs.gitkeep')) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function generateGitKeep($path)
377 377
     {
378
-        $this->filesystem->put($path . '/.gitkeep', '');
378
+        $this->filesystem->put($path.'/.gitkeep', '');
379 379
     }
380 380
 
381 381
     /**
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
     public function generateFiles()
385 385
     {
386 386
         foreach ($this->getFiles() as $stub => $file) {
387
-            $path = $this->module->getModulePath($this->getName()) . $file;
387
+            $path = $this->module->getModulePath($this->getName()).$file;
388 388
 
389
-            $this->component->task("Generating file {$path}", function () use ($stub, $path) {
389
+            $this->component->task("Generating file {$path}", function() use ($stub, $path) {
390 390
                 if (!$this->filesystem->isDirectory($dir = dirname($path))) {
391 391
                     $this->filesystem->makeDirectory($dir, 0775, true);
392 392
                 }
@@ -412,14 +412,14 @@  discard block
 block discarded – undo
412 412
         $providerGenerator = GenerateConfigReader::read('provider');
413 413
         if ($providerGenerator->generate() === true) {
414 414
             $this->console->call('module:make-provider', [
415
-                'name' => $this->getName() . 'ServiceProvider',
415
+                'name' => $this->getName().'ServiceProvider',
416 416
                 'module' => $this->getName(),
417 417
                 '--master' => true,
418 418
             ]);
419 419
         } else {
420 420
             // delete register ServiceProvider on module.json
421
-            $path           = $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . 'module.json';
422
-            $module_file  =   $this->filesystem->get($path);
421
+            $path = $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.'module.json';
422
+            $module_file = $this->filesystem->get($path);
423 423
             $this->filesystem->put(
424 424
                 $path,
425 425
                 preg_replace('/"providers": \[.*?\],/s', '"providers": [ ],', $module_file)
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                 $this->filesystem->replaceInFile(
441 441
                     '$this->app->register(Route',
442 442
                     '// $this->app->register(Route',
443
-                    $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . $providerGenerator->getPath() . DIRECTORY_SEPARATOR . sprintf('%sServiceProvider.php', $this->getName())
443
+                    $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.$providerGenerator->getPath().DIRECTORY_SEPARATOR.sprintf('%sServiceProvider.php', $this->getName())
444 444
                 );
445 445
             }
446 446
         }
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
         if (GenerateConfigReader::read('controller')->generate() === true) {
449 449
             $options = $this->type == 'api' ? ['--api' => true] : [];
450 450
             $this->console->call('module:make-controller', [
451
-                'controller' => $this->getName() . 'Controller',
451
+                'controller' => $this->getName().'Controller',
452 452
                 'module' => $this->getName(),
453 453
             ] + $options);
454 454
         }
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     protected function getStubContents($stub)
465 465
     {
466 466
         return (new Stub(
467
-            '/' . $stub . '.stub',
467
+            '/'.$stub.'.stub',
468 468
             $this->getReplacement($stub)
469 469
         )
470 470
         )->render();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             }
504 504
         }
505 505
         foreach ($keys as $key) {
506
-            if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) {
506
+            if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) {
507 507
                 $replaces[$key] = $this->$method();
508 508
             } else {
509 509
                 $replaces[$key] = null;
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
      */
519 519
     private function generateModuleJsonFile()
520 520
     {
521
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
521
+        $path = $this->module->getModulePath($this->getName()).'module.json';
522 522
 
523
-        $this->component->task("Generating file $path", function () use ($path) {
523
+        $this->component->task("Generating file $path", function() use ($path) {
524 524
             if (!$this->filesystem->isDirectory($dir = dirname($path))) {
525 525
                 $this->filesystem->makeDirectory($dir, 0775, true);
526 526
             }
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
      */
536 536
     private function cleanModuleJsonFile()
537 537
     {
538
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
538
+        $path = $this->module->getModulePath($this->getName()).'module.json';
539 539
 
540 540
         $content = $this->filesystem->get($path);
541 541
         $namespace = $this->getModuleNamespaceReplacement();
542 542
         $studlyName = $this->getStudlyNameReplacement();
543 543
 
544
-        $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"';
544
+        $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"';
545 545
 
546 546
         $content = str_replace($provider, '', $content);
547 547
 
Please login to merge, or discard this patch.
src/Module.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $lowerName = $this->getLowerName();
184 184
 
185
-        $langPath = $this->getPath() . '/Resources/lang';
185
+        $langPath = $this->getPath().'/Resources/lang';
186 186
 
187 187
         if (is_dir($langPath)) {
188 188
             $this->loadTranslationsFrom($langPath, $lowerName);
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
             $file = 'module.json';
199 199
         }
200 200
 
201
-        return Arr::get($this->moduleJson, $file, function () use ($file) {
202
-            return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->files);
201
+        return Arr::get($this->moduleJson, $file, function() use ($file) {
202
+            return $this->moduleJson[$file] = new Json($this->getPath().'/'.$file, $this->files);
203 203
         });
204 204
     }
205 205
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     protected function fireEvent(string $event): void
242 242
     {
243
-        $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]);
243
+        $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
244 244
     }
245 245
 
246 246
     /**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     protected function registerFiles(): void
265 265
     {
266 266
         foreach ($this->get('files', []) as $file) {
267
-            include $this->path . '/' . $file;
267
+            include $this->path.'/'.$file;
268 268
         }
269 269
     }
270 270
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function getExtraPath(string $path): string
351 351
     {
352
-        return $this->getPath() . '/' . $path;
352
+        return $this->getPath().'/'.$path;
353 353
     }
354 354
 
355 355
     /**
Please login to merge, or discard this patch.
src/Commands/Make/RuleMakeCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 
75 75
         $rulePath = GenerateConfigReader::read('rules');
76 76
 
77
-        return $path . $rulePath->getPath() . '/' . $this->getFileName() . '.php';
77
+        return $path.$rulePath->getPath().'/'.$this->getFileName().'.php';
78 78
     }
79 79
 
80 80
     private function getFileName(): string
Please login to merge, or discard this patch.
src/LaravelModulesServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $this->setupStubPath();
35 35
         $this->registerProviders();
36 36
 
37
-        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'modules');
37
+        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'modules');
38 38
     }
39 39
 
40 40
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function setupStubPath(): void
44 44
     {
45
-        $path = $this->app['config']->get('modules.stubs.path') ?? __DIR__ . '/Commands/stubs';
45
+        $path = $this->app['config']->get('modules.stubs.path') ?? __DIR__.'/Commands/stubs';
46 46
 
47 47
         Stub::setBasePath($path);
48 48
 
49
-        $this->app->booted(function ($app) {
49
+        $this->app->booted(function($app) {
50 50
             /** @var RepositoryInterface $moduleRepository */
51 51
             $moduleRepository = $app[RepositoryInterface::class];
52 52
             if ($moduleRepository->config('stubs.enabled') === true) {
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function registerServices(): void
62 62
     {
63
-        $this->app->singleton(RepositoryInterface::class, function ($app) {
63
+        $this->app->singleton(RepositoryInterface::class, function($app) {
64 64
             $path = $app['config']->get('modules.paths.modules');
65 65
 
66 66
             return new LaravelFileRepository($app, $path);
67 67
         });
68 68
 
69
-        $this->app->singleton(ActivatorInterface::class, function ($app) {
69
+        $this->app->singleton(ActivatorInterface::class, function($app) {
70 70
             $activator = $app['config']->get('modules.activator');
71
-            $class = $app['config']->get('modules.activators.' . $activator)['class'];
71
+            $class = $app['config']->get('modules.activators.'.$activator)['class'];
72 72
 
73 73
             if ($class === null) {
74 74
                 throw InvalidActivatorClass::missingConfig();
Please login to merge, or discard this patch.
src/ModulesServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function registerNamespaces(): void
38 38
     {
39
-        $configPath = __DIR__ . '/../config/config.php';
40
-        $stubsPath = dirname(__DIR__) . '/src/Commands/stubs';
39
+        $configPath = __DIR__.'/../config/config.php';
40
+        $stubsPath = dirname(__DIR__).'/src/Commands/stubs';
41 41
 
42 42
         $this->publishes([
43 43
             $configPath => config_path('modules.php'),
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         ], 'stubs');
49 49
 
50 50
         $this->publishes([
51
-            __DIR__ . '/../scripts/vite-module-loader.js' => base_path('vite-module-loader.js'),
51
+            __DIR__.'/../scripts/vite-module-loader.js' => base_path('vite-module-loader.js'),
52 52
         ], 'vite');
53 53
     }
54 54
 
Please login to merge, or discard this patch.
src/Activators/FileActivator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             return $this->readJson();
187 187
         }
188 188
 
189
-        return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->cacheKey, $this->cacheLifetime, function () {
189
+        return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->cacheKey, $this->cacheLifetime, function() {
190 190
             return $this->readJson();
191 191
         });
192 192
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     private function config(string $key): mixed
201 201
     {
202
-        return $this->config->get('modules.activators.file.' . $key, null);
202
+        return $this->config->get('modules.activators.file.'.$key, null);
203 203
     }
204 204
 
205 205
     /**
Please login to merge, or discard this patch.
src/Commands/BaseCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     abstract public function executeAction($name);
42 42
 
43
-    public function getInfo(): string|null
43
+    public function getInfo(): string | null
44 44
     {
45 45
         return null;
46 46
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function handle(): void
52 52
     {
53
-        if (! is_null($info = $this->getInfo())) {
53
+        if (!is_null($info = $this->getInfo())) {
54 54
             $this->components->info($info);
55 55
         }
56 56
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             return;
72 72
         }
73 73
 
74
-        if (! empty($input->getArgument('module'))) {
74
+        if (!empty($input->getArgument('module'))) {
75 75
             return;
76 76
         }
77 77
 
Please login to merge, or discard this patch.
src/Commands/Actions/CheckLangCommand.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         parent::__construct();
31 31
 
32
-        $this->langPath = DIRECTORY_SEPARATOR . config('modules.paths.generator.lang.path', 'Resources/lang');
32
+        $this->langPath = DIRECTORY_SEPARATOR.config('modules.paths.generator.lang.path', 'Resources/lang');
33 33
     }
34 34
 
35 35
     public function executeAction($name): void
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         $directories = $this->getDirectories($module);
40 40
 
41
-        if (! $directories) {
41
+        if (!$directories) {
42 42
             return;
43 43
         }
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     }
50 50
 
51
-    public function getInfo(): string|null
51
+    public function getInfo(): string | null
52 52
     {
53 53
         return 'Checking languages ...';
54 54
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     private function getLangFiles($module): array
57 57
     {
58 58
         $files = [];
59
-        $path  = $module->getPath() . $this->langPath;
59
+        $path  = $module->getPath().$this->langPath;
60 60
         if (is_dir($path)) {
61 61
             $files = array_merge($files, $this->laravel['files']->all($path));
62 62
         }
@@ -64,21 +64,21 @@  discard block
 block discarded – undo
64 64
         return $files;
65 65
     }
66 66
 
67
-    private function getDirectories($module): false|Collection
67
+    private function getDirectories($module): false | Collection
68 68
     {
69 69
         $moduleName = $module->getStudlyName();
70
-        $path       = $module->getPath() . $this->langPath;
70
+        $path       = $module->getPath().$this->langPath;
71 71
         $directories = [];
72 72
         if (is_dir($path)) {
73 73
             $directories = $this->laravel['files']->directories($path);
74
-            $directories = array_map(function ($directory) use ($moduleName) {
74
+            $directories = array_map(function($directory) use ($moduleName) {
75 75
                 return [
76 76
                     'name'   => basename($directory),
77 77
                     'module' => $moduleName,
78 78
                     'path'   => $directory,
79
-                    'files'  => array_map(function ($file) {
79
+                    'files'  => array_map(function($file) {
80 80
                         return basename($file);
81
-                    }, \File::glob($directory . DIRECTORY_SEPARATOR . "*")),
81
+                    }, \File::glob($directory.DIRECTORY_SEPARATOR."*")),
82 82
                 ];
83 83
             }, $directories);
84 84
         }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 
106 106
         $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values();
107 107
 
108
-        $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
108
+        $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
109 109
 
110 110
             $missingFiles = $uniqeLangFiles->diff($directory['files']);
111 111
 
112 112
             if ($missingFiles->count() > 0) {
113
-                $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) {
113
+                $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) {
114 114
                     $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}";
115 115
                 });
116 116
             }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         if (count($missingFilesMessage) > 0) {
121 121
 
122
-            collect($missingFilesMessage)->each(function ($messages, $langDirectory) {
122
+            collect($missingFilesMessage)->each(function($messages, $langDirectory) {
123 123
 
124 124
                 $this->components->error("Missing language files in $langDirectory directory");
125 125
 
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
         $langDirectories = $directories->pluck('name');
143 143
 
144 144
         $missingKeysMessage = [];
145
-        $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
145
+        $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
146 146
 
147
-            $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) {
148
-                $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file);
147
+            $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) {
148
+                $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file);
149 149
 
150 150
                 if ($langKeys == false) {
151 151
                     return;
152 152
                 }
153 153
 
154
-                $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
154
+                $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
155 155
 
156 156
                     if ($directory['name'] != $langDirectory) {
157 157
 
158 158
                         $basePath = str_replace($directory['name'], $langDirectory, $directory['path']);
159 159
 
160
-                        $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file);
160
+                        $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file);
161 161
 
162 162
                         if ($otherLangKeys === false) {
163 163
                             return;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                         $missingKeys = $langKeys->diff($otherLangKeys);
167 167
                         if ($missingKeys->count() > 0) {
168 168
 
169
-                            $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
169
+                            $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
170 170
                                 $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey";
171 171
                             });
172 172
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
         if (count($missingKeysMessage) > 0) {
180 180
 
181
-            collect($missingKeysMessage)->each(function ($messages, $langDirectory) {
181
+            collect($missingKeysMessage)->each(function($messages, $langDirectory) {
182 182
 
183 183
                 $this->components->error("Missing language keys for directory $langDirectory:");
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         }
192 192
     }
193 193
 
194
-    private function getLangKeys($file): false|Collection
194
+    private function getLangKeys($file): false | Collection
195 195
     {
196 196
         if (File::exists($file)) {
197 197
             $lang = File::getRequire($file);
Please login to merge, or discard this patch.