Completed
Pull Request — master (#2042)
by
unknown
12:11 queued 02:10
created
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)->trim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment) => ! empty($segment))->implode($ds);
18
+        return Str::of($path)->trim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment) => !empty($segment))->implode($ds);
19 19
     }
20 20
 
21 21
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function module_namespace(string $module, ?string $path = null): string
57 57
     {
58 58
         $module_namespace = rtrim(config('modules.namespace', config('modules.paths.modules')), '\\').'\\'.($module);
59
-        if (! empty($path)) {
59
+        if (!empty($path)) {
60 60
             $module_namespace .= '\\'.ltrim($path, '\\');
61 61
         }
62 62
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Support\Facades\Vite as ViteFacade;
6 6
 use Nwidart\Modules\Laravel\Module;
7 7
 
8
-if (! function_exists('module')) {
8
+if (!function_exists('module')) {
9 9
     /**
10 10
      * Retrieves a module status or its instance.
11 11
      *
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
      * @param  bool  $instance  Whether to return the module's instance instead of the status. Defaults to false [status].
14 14
      * @return bool|Module The module instance or its status.
15 15
      */
16
-    function module(string $name, bool $instance = false): bool|Module
16
+    function module(string $name, bool $instance = false): bool | Module
17 17
     {
18 18
         $modules = app('modules');
19
-        if (! $modules->has($name)) {
19
+        if (!$modules->has($name)) {
20 20
             Log::error("Module '$name' not found.");
21 21
 
22 22
             return false;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     }
27 27
 }
28 28
 
29
-if (! function_exists('module_path')) {
29
+if (!function_exists('module_path')) {
30 30
     function module_path(string $name, string $path = ''): string
31 31
     {
32 32
         $module = app('modules')->find($name);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     }
36 36
 }
37 37
 
38
-if (! function_exists('config_path')) {
38
+if (!function_exists('config_path')) {
39 39
     /**
40 40
      * Get the configuration path.
41 41
      */
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     }
46 46
 }
47 47
 
48
-if (! function_exists('public_path')) {
48
+if (!function_exists('public_path')) {
49 49
     /**
50 50
      * Get the path to the public folder.
51 51
      */
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     }
56 56
 }
57 57
 
58
-if (! function_exists('module_vite')) {
58
+if (!function_exists('module_vite')) {
59 59
     /**
60 60
      * support for vite
61 61
      */
Please login to merge, or discard this patch.
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   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     /**
264 264
      * Set force status.
265 265
      */
266
-    public function setForce(bool|int $force): self
266
+    public function setForce(bool | int $force): self
267 267
     {
268 268
         $this->force = $force;
269 269
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
         foreach ($this->getFiles() as $stub => $file) {
355 355
             $path = $this->module->getModulePath($this->getName()).$file;
356 356
 
357
-            $this->component->task("Generating file {$path}", function () use ($stub, $path) {
358
-                if (! $this->filesystem->isDirectory($dir = dirname($path))) {
357
+            $this->component->task("Generating file {$path}", function() use ($stub, $path) {
358
+                if (!$this->filesystem->isDirectory($dir = dirname($path))) {
359 359
                     $this->filesystem->makeDirectory($dir, 0775, true);
360 360
                 }
361 361
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         $eventGeneratorConfig = GenerateConfigReader::read('event-provider');
398 398
         if (
399 399
             (is_null($eventGeneratorConfig->getPath()) && $providerGenerator->generate())
400
-            || (! is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate())
400
+            || (!is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate())
401 401
         ) {
402 402
             $this->console->call('module:make-event-provider', [
403 403
                 'module' => $this->getName(),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $routeGeneratorConfig = GenerateConfigReader::read('route-provider');
417 417
         if (
418 418
             (is_null($routeGeneratorConfig->getPath()) && $providerGenerator->generate())
419
-            || (! is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate())
419
+            || (!is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate())
420 420
         ) {
421 421
             $this->console->call('module:route-provider', [
422 422
                 'module' => $this->getName(),
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
         $replacements = $this->module->config('stubs.replacements');
470 470
 
471 471
         // Temporarily check if the replacements are defined; remove in the next major version.
472
-        if (! isset($replacements['composer']['APP_FOLDER_NAME'])) {
472
+        if (!isset($replacements['composer']['APP_FOLDER_NAME'])) {
473 473
             $replacements['composer'][] = 'APP_FOLDER_NAME';
474 474
         }
475
-        if (! isset($replacements['routes/web']['PLURAL_LOWER_NAME'])) {
475
+        if (!isset($replacements['routes/web']['PLURAL_LOWER_NAME'])) {
476 476
             $replacements['routes/web'][] = 'PLURAL_LOWER_NAME';
477 477
         }
478
-        if (! isset($replacements['routes/api']['PLURAL_LOWER_NAME'])) {
478
+        if (!isset($replacements['routes/api']['PLURAL_LOWER_NAME'])) {
479 479
             $replacements['routes/api'][] = 'PLURAL_LOWER_NAME';
480 480
         }
481 481
 
482
-        if (! isset($replacements[$stub])) {
482
+        if (!isset($replacements[$stub])) {
483 483
             return [];
484 484
         }
485 485
 
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
     {
520 520
         $path = $this->module->getModulePath($this->getName()).'module.json';
521 521
 
522
-        $this->component->task("Generating file $path", function () use ($path) {
523
-            if (! $this->filesystem->isDirectory($dir = dirname($path))) {
522
+        $this->component->task("Generating file $path", function() use ($path) {
523
+            if (!$this->filesystem->isDirectory($dir = dirname($path))) {
524 524
                 $this->filesystem->makeDirectory($dir, 0775, true);
525 525
             }
526 526
 
Please login to merge, or discard this patch.