@@ -182,7 +182,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -36,8 +36,8 @@ discard block |
||
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 |
||
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 |
@@ -186,7 +186,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -40,7 +40,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $module = $this->getModuleModel($name); |
40 | 40 | |
41 | - $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
41 | + $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
42 | 42 | try { |
43 | 43 | $this->moduleSeed($module); |
44 | 44 | } catch (\Error $e) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | }); |
57 | 57 | } |
58 | 58 | |
59 | - public function getInfo(): string|null |
|
59 | + public function getInfo(): string | null |
|
60 | 60 | { |
61 | 61 | return 'Seeding module ...'; |
62 | 62 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $config = $module->get('migration'); |
105 | 105 | |
106 | 106 | if (is_array($config) && array_key_exists('seeds', $config)) { |
107 | - foreach ((array)$config['seeds'] as $class) { |
|
107 | + foreach ((array) $config['seeds'] as $class) { |
|
108 | 108 | if (class_exists($class)) { |
109 | 109 | $seeders[] = $class; |
110 | 110 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function dbSeed(string $className): void |
142 | 142 | { |
143 | 143 | if ($option = $this->option('class')) { |
144 | - $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\') . $option; |
|
144 | + $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\').$option; |
|
145 | 145 | } else { |
146 | 146 | $params = ['--class' => $className]; |
147 | 147 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $config = GenerateConfigReader::read('seeder'); |
173 | 173 | $seederPath = str_replace('/', '\\', $config->getPath()); |
174 | 174 | |
175 | - return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
175 | + return $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $foundModules = []; |
193 | 193 | foreach ($this->laravel['modules']->config('scan.paths') as $path) { |
194 | 194 | $namespace = array_slice(explode('/', $path), -1)[0]; |
195 | - $foundModules[] = $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
195 | + $foundModules[] = $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $foundModules; |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | use Illuminate\Foundation\Vite; |
5 | 5 | use Illuminate\Support\Facades\Vite as ViteFacade; |
6 | 6 | |
7 | -if (! function_exists('module_path')) { |
|
7 | +if (!function_exists('module_path')) { |
|
8 | 8 | function module_path($name, $path = ''): string |
9 | 9 | { |
10 | 10 | $module = app('modules')->find($name); |
11 | 11 | |
12 | - return $module->getPath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
12 | + return $module->getPath().($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
16 | -if (! function_exists('config_path')) { |
|
16 | +if (!function_exists('config_path')) { |
|
17 | 17 | /** |
18 | 18 | * Get the configuration path. |
19 | 19 | * |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function config_path(string $path = ''): string |
24 | 24 | { |
25 | - return app()->basePath() . '/config' . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
25 | + return app()->basePath().'/config'.($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if (! function_exists('public_path')) { |
|
29 | +if (!function_exists('public_path')) { |
|
30 | 30 | /** |
31 | 31 | * Get the path to the public folder. |
32 | 32 | * |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function public_path(string $path = ''): string |
38 | 38 | { |
39 | - return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
39 | + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -if (! function_exists('module_vite')) { |
|
43 | +if (!function_exists('module_vite')) { |
|
44 | 44 | /** |
45 | 45 | * support for vite |
46 | 46 | */ |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function toArray(): array |
28 | 28 | { |
29 | - return array_map(function ($value) { |
|
29 | + return array_map(function($value) { |
|
30 | 30 | if ($value instanceof Module) { |
31 | 31 | $attributes = $value->json()->getAttributes(); |
32 | 32 | $attributes["path"] = $value->getPath(); |