@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $file = 'module.json'; |
222 | 222 | } |
223 | 223 | |
224 | - return Arr::get($this->moduleJson, $file, function () use ($file) { |
|
224 | + return Arr::get($this->moduleJson, $file, function() use ($file) { |
|
225 | 225 | return $this->moduleJson[$file] = new Json($this->getPath().'/'.$file, $this->files); |
226 | 226 | }); |
227 | 227 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | public function isDisabled(): bool |
330 | 330 | { |
331 | - return ! $this->isEnabled(); |
|
331 | + return !$this->isEnabled(); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | { |
395 | 395 | return config('modules.register.files', 'register') === 'boot' && |
396 | 396 | // force register method if option == boot && app is AsgardCms |
397 | - ! class_exists('\Modules\Core\Foundation\AsgardCms'); |
|
397 | + !class_exists('\Modules\Core\Foundation\AsgardCms'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $path = $this->app['config']->get('modules.stubs.path') ?? __DIR__.'/Commands/stubs'; |
67 | 67 | Stub::setBasePath($path); |
68 | 68 | |
69 | - $this->app->booted(function ($app) { |
|
69 | + $this->app->booted(function($app) { |
|
70 | 70 | /** @var RepositoryInterface $moduleRepository */ |
71 | 71 | $moduleRepository = $app[RepositoryInterface::class]; |
72 | 72 | if ($moduleRepository->config('stubs.enabled') === true) { |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function registerServices() |
82 | 82 | { |
83 | - $this->app->singleton(Contracts\RepositoryInterface::class, function ($app) { |
|
83 | + $this->app->singleton(Contracts\RepositoryInterface::class, function($app) { |
|
84 | 84 | $path = $app['config']->get('modules.paths.modules'); |
85 | 85 | |
86 | 86 | return new Laravel\LaravelFileRepository($app, $path); |
87 | 87 | }); |
88 | - $this->app->singleton(Contracts\ActivatorInterface::class, function ($app) { |
|
88 | + $this->app->singleton(Contracts\ActivatorInterface::class, function($app) { |
|
89 | 89 | $activator = $app['config']->get('modules.activator'); |
90 | 90 | $class = $app['config']->get('modules.activators.'.$activator)['class']; |
91 | 91 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | protected function registerMigrations(): void |
102 | 102 | { |
103 | - if (! $this->app['config']->get('modules.auto-discover.migrations', true)) { |
|
103 | + if (!$this->app['config']->get('modules.auto-discover.migrations', true)) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - $this->app->resolving(Migrator::class, function (Migrator $migrator) { |
|
107 | + $this->app->resolving(Migrator::class, function(Migrator $migrator) { |
|
108 | 108 | $migration_path = $this->app['config']->get('modules.paths.generator.migration.path'); |
109 | 109 | collect(\Nwidart\Modules\Facades\Module::allEnabled()) |
110 | - ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) { |
|
110 | + ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) { |
|
111 | 111 | $migrator->path($module->getExtraPath($migration_path)); |
112 | 112 | }); |
113 | 113 | }); |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | |
116 | 116 | protected function registerTranslations(): void |
117 | 117 | { |
118 | - if (! $this->app['config']->get('modules.auto-discover.translations', true)) { |
|
118 | + if (!$this->app['config']->get('modules.auto-discover.translations', true)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | - $this->callAfterResolving('translator', function (TranslatorContract $translator) { |
|
122 | - if (! $translator instanceof Translator) { |
|
121 | + $this->callAfterResolving('translator', function(TranslatorContract $translator) { |
|
122 | + if (!$translator instanceof Translator) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | 126 | collect(\Nwidart\Modules\Facades\Module::allEnabled()) |
127 | - ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($translator) { |
|
127 | + ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($translator) { |
|
128 | 128 | $path = $module->getExtraPath($this->app['config']->get('modules.paths.generator.lang.path')); |
129 | 129 | $translator->addNamespace($module->getLowerName(), $path); |
130 | 130 | $translator->addJsonPath($path); |
@@ -85,11 +85,11 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -66,7 +66,7 @@ |
||
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(); |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return 'Application In Production'; |
65 | 65 | } |
66 | 66 | |
67 | - public function getConfirmableCallback(): \Closure|bool|null |
|
67 | + public function getConfirmableCallback(): \Closure | bool | null |
|
68 | 68 | { |
69 | 69 | return null; |
70 | 70 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | { |
77 | 77 | if ($this instanceof ConfirmableCommand) { |
78 | 78 | if ($this->isProhibited() || |
79 | - ! $this->confirmToProceed($this->getConfirmableLabel(), $this->getConfirmableCallback())) { |
|
79 | + !$this->confirmToProceed($this->getConfirmableLabel(), $this->getConfirmableCallback())) { |
|
80 | 80 | return Command::FAILURE; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - if (! is_null($info = $this->getInfo())) { |
|
84 | + if (!is_null($info = $this->getInfo())) { |
|
85 | 85 | $this->components->info($info); |
86 | 86 | } |
87 | 87 | |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - if (! empty($input->getArgument('module'))) { |
|
107 | + if (!empty($input->getArgument('module'))) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | 111 | $selected_item = multisearch( |
112 | 112 | label: 'Select Modules', |
113 | - options: function (string $search_value) use ($modules) { |
|
113 | + options: function(string $search_value) use ($modules) { |
|
114 | 114 | return collect([ |
115 | 115 | self::ALL, |
116 | 116 | ...$modules, |
117 | - ])->when(strlen($search_value) > 0, function (Collection &$modules) use ($search_value) { |
|
117 | + ])->when(strlen($search_value) > 0, function(Collection & $modules) use ($search_value) { |
|
118 | 118 | return $modules->filter(fn ($item) => str_contains(strtolower($item), strtolower($search_value))); |
119 | 119 | })->values()->toArray(); |
120 | 120 | }, |
@@ -20,7 +20,7 @@ |
||
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(); |
@@ -52,7 +52,7 @@ |
||
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. |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function config(string $key): array |
81 | 81 | { |
82 | - return collect($this->getManifest())->flatMap(function ($configuration) use ($key) { |
|
82 | + return collect($this->getManifest())->flatMap(function($configuration) use ($key) { |
|
83 | 83 | return (array) ($configuration[$key] ?? []); |
84 | 84 | })->filter()->all(); |
85 | 85 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getManifest(): array |
91 | 91 | { |
92 | - if (! is_null($this->manifest)) { |
|
92 | + if (!is_null($this->manifest)) { |
|
93 | 93 | return $this->manifest; |
94 | 94 | } |
95 | 95 | |
96 | - if (! is_file($this->manifestPath)) { |
|
96 | + if (!is_file($this->manifestPath)) { |
|
97 | 97 | $this->build(); |
98 | 98 | } |
99 | 99 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function write(array $manifest): void |
130 | 130 | { |
131 | - if (! is_writable($dirname = dirname($this->manifestPath))) { |
|
131 | + if (!is_writable($dirname = dirname($this->manifestPath))) { |
|
132 | 132 | throw new Exception("The {$dirname} directory must be present and writable."); |
133 | 133 | } |
134 | 134 | $this->files->replace( |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | // todo check this section store on module.php or not? |
143 | 143 | $this->getModulesData() |
144 | - ->each(function (array $manifest) { |
|
144 | + ->each(function(array $manifest) { |
|
145 | 145 | if (empty($manifest['files'])) { |
146 | 146 | return; |
147 | 147 | } |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | |
155 | 155 | public function getModulesData(): Collection |
156 | 156 | { |
157 | - if (! empty(self::$manifestData) && ! app()->runningUnitTests()) { |
|
157 | + if (!empty(self::$manifestData) && !app()->runningUnitTests()) { |
|
158 | 158 | return self::$manifestData; |
159 | 159 | } |
160 | 160 | |
161 | 161 | self::$manifestData = $this->paths |
162 | - ->flatMap(function ($path) { |
|
162 | + ->flatMap(function($path) { |
|
163 | 163 | $manifests = $this->files->glob("{$path}/module.json"); |
164 | 164 | is_array($manifests) || $manifests = []; |
165 | 165 | |
166 | 166 | return collect($manifests) |
167 | - ->map(function ($manifest) { |
|
167 | + ->map(function($manifest) { |
|
168 | 168 | return [ |
169 | 169 | 'module_directory' => dirname($manifest), |
170 | 170 | ...$this->files->json($manifest), |