Completed
Pull Request — master (#2114)
by Solomon
06:25
created
src/Activators/FileActivator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * {@inheritDoc}
87 87
      */
88
-    public function hasStatus(Module|string $module, bool $status): bool
88
+    public function hasStatus(Module | string $module, bool $status): bool
89 89
     {
90 90
         $name = $module instanceof Module ? $module->getName() : $module;
91 91
 
92
-        if (! isset($this->modulesStatuses[$name])) {
92
+        if (!isset($this->modulesStatuses[$name])) {
93 93
             return $status === false;
94 94
         }
95 95
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function delete(Module $module): void
120 120
     {
121
-        if (! isset($this->modulesStatuses[$module->getName()])) {
121
+        if (!isset($this->modulesStatuses[$module->getName()])) {
122 122
             return;
123 123
         }
124 124
         unset($this->modulesStatuses[$module->getName()]);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     private function readJson(): array
142 142
     {
143
-        if (! $this->files->exists($this->statusesFile)) {
143
+        if (!$this->files->exists($this->statusesFile)) {
144 144
             return [];
145 145
         }
146 146
 
Please login to merge, or discard this patch.
src/Commands/Actions/ModelShowCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         return [
67 67
             'model' => fn () => search(
68 68
                 label: 'Select Model',
69
-                options: function (string $search_value) {
69
+                options: function(string $search_value) {
70 70
                     return $this->findModels(
71 71
                         Str::of($search_value)->wrap('', '*')
72 72
                     )->toArray();
Please login to merge, or discard this patch.
src/Commands/Actions/ModuleDeleteCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function executeAction($name): void
15 15
     {
16 16
         $module = $this->getModuleModel($name);
17
-        $this->components->task("Deleting <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
17
+        $this->components->task("Deleting <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) {
18 18
             $module->delete();
19 19
         });
20 20
     }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return 'Warning: Do you want to remove the module?';
30 30
     }
31 31
 
32
-    public function getConfirmableCallback(): \Closure|bool|null
32
+    public function getConfirmableCallback(): \Closure | bool | null
33 33
     {
34 34
         return true;
35 35
     }
Please login to merge, or discard this patch.
src/Collection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function toArray(): array
22 22
     {
23
-        return array_map(function ($value) {
23
+        return array_map(function($value) {
24 24
             if ($value instanceof Module) {
25 25
                 $attributes = $value->json()->getAttributes();
26 26
                 $attributes['path'] = $value->getPath();
Please login to merge, or discard this patch.
src/Contracts/RepositoryInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     /**
53 53
      * Get modules by the given status.
54 54
      */
55
-    public function getByStatus(int|bool $status);
55
+    public function getByStatus(int | bool $status);
56 56
 
57 57
     /**
58 58
      * Find a specific module.
Please login to merge, or discard this patch.
src/FileRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $paths = array_merge($paths, $this->config('scan.paths'));
111 111
         }
112 112
 
113
-        $paths = array_map(function ($path) {
113
+        $paths = array_map(function($path) {
114 114
             return Str::endsWith($path, '/*') ? $path : Str::finish($path, '/*');
115 115
         }, $paths);
116 116
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function scan(): array
129 129
     {
130
-        if (! empty(self::$modules) && ! $this->app->runningUnitTests()) {
130
+        if (!empty(self::$modules) && !$this->app->runningUnitTests()) {
131 131
             return self::$modules;
132 132
         }
133 133
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $modules = $this->allEnabled();
225 225
 
226
-        uasort($modules, function (Module $a, Module $b) use ($direction) {
226
+        uasort($modules, function(Module $a, Module $b) use ($direction) {
227 227
             if ($a->get('priority') === $b->get('priority')) {
228 228
                 return 0;
229 229
             }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         }
338 338
 
339 339
         $path = storage_path('app/modules/modules.used');
340
-        if (! $this->getFiles()->exists($path)) {
340
+        if (!$this->getFiles()->exists($path)) {
341 341
             $this->getFiles()->put($path, '');
342 342
         }
343 343
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      */
427 427
     public function isDisabled(string $name): bool
428 428
     {
429
-        return ! $this->isEnabled($name);
429
+        return !$this->isEnabled($name);
430 430
     }
431 431
 
432 432
     /**
Please login to merge, or discard this patch.
src/Commands/Actions/ModelPruneCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return;
51 51
         }
52 52
 
53
-        if (! empty($input->getArgument('module'))) {
53
+        if (!empty($input->getArgument('module'))) {
54 54
             return;
55 55
         }
56 56
 
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function models(): Collection
79 79
     {
80
-        if (! empty($models = $this->option('model'))) {
81
-            return collect($models)->filter(function ($model) {
80
+        if (!empty($models = $this->option('model'))) {
81
+            return collect($models)->filter(function($model) {
82 82
                 return class_exists($model);
83 83
             })->values();
84 84
         }
85 85
 
86 86
         $except = $this->option('except');
87 87
 
88
-        if (! empty($models) && ! empty($except)) {
88
+        if (!empty($models) && !empty($except)) {
89 89
             throw new InvalidArgumentException('The --models and --except options cannot be combined.');
90 90
         }
91 91
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         return collect(Finder::create()->in($path)->files()->name('*.php'))
112
-            ->map(function ($model) {
112
+            ->map(function($model) {
113 113
 
114 114
                 $namespace = config('modules.namespace');
115 115
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
                 );
121 121
             })
122 122
             ->values()
123
-            ->when(! empty($except), function ($models) use ($except) {
124
-                return $models->reject(function ($model) use ($except) {
123
+            ->when(!empty($except), function($models) use ($except) {
124
+                return $models->reject(function($model) use ($except) {
125 125
                     return in_array($model, $except);
126 126
                 });
127
-            })->filter(function ($model) {
127
+            })->filter(function($model) {
128 128
                 return class_exists($model);
129
-            })->filter(function ($model) {
129
+            })->filter(function($model) {
130 130
                 return $this->isPrunable($model);
131 131
             })->values();
132 132
     }
Please login to merge, or discard this patch.
src/ModuleManifest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getProviders(): array
56 56
     {
57
-        if (! empty($this->manifest)) {
57
+        if (!empty($this->manifest)) {
58 58
             return $this->manifest;
59 59
         }
60 60
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         // todo check this section store on module.php or not?
79 79
         $this->getModulesData()
80
-            ->each(function (array $manifest) {
80
+            ->each(function(array $manifest) {
81 81
                 if (empty($manifest['files'])) {
82 82
                     return;
83 83
                 }
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function getModulesData(): Collection
92 92
     {
93
-        if (! empty(self::$manifestData) && ! app()->runningUnitTests()) {
93
+        if (!empty(self::$manifestData) && !app()->runningUnitTests()) {
94 94
             return self::$manifestData;
95 95
         }
96 96
 
97 97
         self::$manifestData = $this->paths
98
-            ->flatMap(function ($path) {
98
+            ->flatMap(function($path) {
99 99
                 $manifests = $this->files->glob("{$path}/module.json");
100 100
                 is_array($manifests) || $manifests = [];
101 101
 
102 102
                 return collect($manifests)
103
-                    ->map(function ($manifest) {
103
+                    ->map(function($manifest) {
104 104
                         return [
105 105
                             'module_directory' => dirname($manifest),
106 106
                             ...$this->files->json($manifest),
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.