Completed
Pull Request — master (#2042)
by Solomon
09:58
created
src/LaravelModulesServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         ]);
41 41
 
42 42
         // Create @module() blade directive.
43
-        Blade::if('module', function (string $name) {
43
+        Blade::if ('module', function(string $name) {
44 44
             return module($name);
45 45
         });
46 46
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $path = $this->app['config']->get('modules.stubs.path') ?? __DIR__.'/Commands/stubs';
69 69
         Stub::setBasePath($path);
70 70
 
71
-        $this->app->booted(function ($app) {
71
+        $this->app->booted(function($app) {
72 72
             /** @var RepositoryInterface $moduleRepository */
73 73
             $moduleRepository = $app[RepositoryInterface::class];
74 74
             if ($moduleRepository->config('stubs.enabled') === true) {
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
      */
83 83
     protected function registerServices()
84 84
     {
85
-        $this->app->singleton(Contracts\RepositoryInterface::class, function ($app) {
85
+        $this->app->singleton(Contracts\RepositoryInterface::class, function($app) {
86 86
             $path = $app['config']->get('modules.paths.modules');
87 87
 
88 88
             return new Laravel\LaravelFileRepository($app, $path);
89 89
         });
90
-        $this->app->singleton(Contracts\ActivatorInterface::class, function ($app) {
90
+        $this->app->singleton(Contracts\ActivatorInterface::class, function($app) {
91 91
             $activator = $app['config']->get('modules.activator');
92 92
             $class = $app['config']->get('modules.activators.'.$activator)['class'];
93 93
 
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 
103 103
     protected function registerMigrations(): void
104 104
     {
105
-        if (! $this->app['config']->get('modules.auto-discover.migrations', true)) {
105
+        if (!$this->app['config']->get('modules.auto-discover.migrations', true)) {
106 106
             return;
107 107
         }
108 108
 
109
-        $this->app->resolving(Migrator::class, function (Migrator $migrator) {
109
+        $this->app->resolving(Migrator::class, function(Migrator $migrator) {
110 110
             $migration_path = $this->app['config']->get('modules.paths.generator.migration.path');
111 111
             collect(\Nwidart\Modules\Facades\Module::allEnabled())
112
-                ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) {
112
+                ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) {
113 113
                     $migrator->path($module->getExtraPath($migration_path));
114 114
                 });
115 115
         });
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 
118 118
     protected function registerTranslations(): void
119 119
     {
120
-        if (! $this->app['config']->get('modules.auto-discover.translations', true)) {
120
+        if (!$this->app['config']->get('modules.auto-discover.translations', true)) {
121 121
             return;
122 122
         }
123
-        $this->callAfterResolving('translator', function (TranslatorContract $translator) {
124
-            if (! $translator instanceof Translator) {
123
+        $this->callAfterResolving('translator', function(TranslatorContract $translator) {
124
+            if (!$translator instanceof Translator) {
125 125
                 return;
126 126
             }
127 127
 
128 128
             collect(\Nwidart\Modules\Facades\Module::allEnabled())
129
-                ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($translator) {
129
+                ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($translator) {
130 130
                     $path = $module->getExtraPath($this->app['config']->get('modules.paths.generator.lang.path'));
131 131
                     $translator->addNamespace($module->getLowerName(), $path);
132 132
                     $translator->addJsonPath($path);
Please login to merge, or discard this patch.
src/Generators/ModuleGenerator.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     /**
265 265
      * Set force status.
266 266
      */
267
-    public function setForce(bool|int $force): self
267
+    public function setForce(bool | int $force): self
268 268
     {
269 269
         $this->force = $force;
270 270
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
         foreach ($this->getFiles() as $stub => $file) {
356 356
             $path = $this->module->getModulePath($this->getName()).$file;
357 357
 
358
-            $this->component->task("Generating file {$path}", function () use ($stub, $path) {
359
-                if (! $this->filesystem->isDirectory($dir = dirname($path))) {
358
+            $this->component->task("Generating file {$path}", function() use ($stub, $path) {
359
+                if (!$this->filesystem->isDirectory($dir = dirname($path))) {
360 360
                     $this->filesystem->makeDirectory($dir, 0775, true);
361 361
                 }
362 362
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         $eventGeneratorConfig = GenerateConfigReader::read('event-provider');
399 399
         if (
400 400
             (is_null($eventGeneratorConfig->getPath()) && $providerGenerator->generate())
401
-            || (! is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate())
401
+            || (!is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate())
402 402
         ) {
403 403
             $this->console->call('module:make-event-provider', [
404 404
                 'module' => $this->getName(),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         $routeGeneratorConfig = GenerateConfigReader::read('route-provider');
418 418
         if (
419 419
             (is_null($routeGeneratorConfig->getPath()) && $providerGenerator->generate())
420
-            || (! is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate())
420
+            || (!is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate())
421 421
         ) {
422 422
             $this->console->call('module:route-provider', [
423 423
                 'module' => $this->getName(),
@@ -470,21 +470,21 @@  discard block
 block discarded – undo
470 470
         $replacements = $this->module->config('stubs.replacements');
471 471
 
472 472
         // Temporarily check if the replacements are defined; remove in the next major version.
473
-        if (! isset($replacements['composer']['APP_PATH'])) {
473
+        if (!isset($replacements['composer']['APP_PATH'])) {
474 474
             $replacements['composer'][] = 'APP_PATH';
475 475
         }
476 476
 
477
-        if (! isset($replacements['composer']['APP_PATH_NAMESPACE'])) {
477
+        if (!isset($replacements['composer']['APP_PATH_NAMESPACE'])) {
478 478
             $replacements['composer'][] = 'APP_PATH_NAMESPACE';
479 479
         }
480
-        if (! isset($replacements['routes/web']['PLURAL_LOWER_NAME'])) {
480
+        if (!isset($replacements['routes/web']['PLURAL_LOWER_NAME'])) {
481 481
             $replacements['routes/web'][] = 'PLURAL_LOWER_NAME';
482 482
         }
483
-        if (! isset($replacements['routes/api']['PLURAL_LOWER_NAME'])) {
483
+        if (!isset($replacements['routes/api']['PLURAL_LOWER_NAME'])) {
484 484
             $replacements['routes/api'][] = 'PLURAL_LOWER_NAME';
485 485
         }
486 486
 
487
-        if (! isset($replacements[$stub])) {
487
+        if (!isset($replacements[$stub])) {
488 488
             return [];
489 489
         }
490 490
 
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
     {
525 525
         $path = $this->module->getModulePath($this->getName()).'module.json';
526 526
 
527
-        $this->component->task("Generating file $path", function () use ($path) {
528
-            if (! $this->filesystem->isDirectory($dir = dirname($path))) {
527
+        $this->component->task("Generating file $path", function() use ($path) {
528
+            if (!$this->filesystem->isDirectory($dir = dirname($path))) {
529 529
                 $this->filesystem->makeDirectory($dir, 0775, true);
530 530
             }
531 531
 
Please login to merge, or discard this patch.
src/Traits/PathNamespace.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             $replace = $ds === '/' ? '\\' : '/';
16 16
         }
17 17
 
18
-        return Str::of($path)->rtrim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment, $key) => $key == 0 or ! empty($segment))->implode($ds);
18
+        return Str::of($path)->rtrim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment, $key) => $key == 0 or !empty($segment))->implode($ds);
19 19
     }
20 20
 
21 21
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function module_namespace(string $module, ?string $path = null): string
89 89
     {
90 90
         $module_namespace = rtrim(config('modules.namespace') ?? config('modules.paths.modules'), '\\').'\\'.($module);
91
-        if (! empty($path)) {
91
+        if (!empty($path)) {
92 92
             $module_namespace .= '\\'.trim($path, '\\');
93 93
         }
94 94
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Nwidart\Modules\FileRepository;
7 7
 use Nwidart\Modules\Module;
8 8
 
9
-if (! function_exists('module')) {
9
+if (!function_exists('module')) {
10 10
     /**
11 11
      * Retrieves a module status or its instance.
12 12
      *
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      * @param  bool  $instance  Whether to return the module's instance instead of the status. Defaults to false [status].
15 15
      * @return bool|Module The module instance or its status.
16 16
      */
17
-    function module(string $name, bool $instance = false): bool|Module
17
+    function module(string $name, bool $instance = false): bool | Module
18 18
     {
19 19
         /** @var FileRepository $repository */
20 20
         $repository = app('modules');
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     }
30 30
 }
31 31
 
32
-if (! function_exists('module_path')) {
32
+if (!function_exists('module_path')) {
33 33
     function module_path(string $name, string $path = ''): string
34 34
     {
35 35
         $module = module($name, true);
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     }
39 39
 }
40 40
 
41
-if (! function_exists('config_path')) {
41
+if (!function_exists('config_path')) {
42 42
     /**
43 43
      * Get the configuration path.
44 44
      */
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     }
49 49
 }
50 50
 
51
-if (! function_exists('public_path')) {
51
+if (!function_exists('public_path')) {
52 52
     /**
53 53
      * Get the path to the public folder.
54 54
      */
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     }
59 59
 }
60 60
 
61
-if (! function_exists('module_vite')) {
61
+if (!function_exists('module_vite')) {
62 62
     /**
63 63
      * support for vite
64 64
      */
Please login to merge, or discard this patch.