@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $factoryPath = GenerateConfigReader::read('factory'); |
71 | 71 | |
72 | - return $path . $factoryPath->getPath() . '/' . $this->getFileName(); |
|
72 | + return $path.$factoryPath->getPath().'/'.$this->getFileName(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | private function getFileName() |
79 | 79 | { |
80 | - return Str::studly($this->argument('name')) . 'Factory.php'; |
|
80 | + return Str::studly($this->argument('name')).'Factory.php'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -111,6 +111,6 @@ discard block |
||
111 | 111 | |
112 | 112 | $path = str_replace('/', '\\', $path); |
113 | 113 | |
114 | - return $this->laravel['modules']->config('namespace') . '\\' . $this->laravel['modules']->findOrFail($this->getModuleName()) . '\\' . $path; |
|
114 | + return $this->laravel['modules']->config('namespace').'\\'.$this->laravel['modules']->findOrFail($this->getModuleName()).'\\'.$path; |
|
115 | 115 | } |
116 | 116 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function handle(): int |
33 | 33 | { |
34 | 34 | |
35 | - $this->langPath = DIRECTORY_SEPARATOR . config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
35 | + $this->langPath = DIRECTORY_SEPARATOR.config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
36 | 36 | |
37 | 37 | $this->components->alert('Checking languages ...'); |
38 | 38 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $directories = $this->getDirectories($module); |
82 | 82 | |
83 | - if (! $directories) { |
|
83 | + if (!$directories) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | private function getLangFiles($module) |
106 | 106 | { |
107 | 107 | $files = []; |
108 | - $path = $module->getPath() . $this->langPath; |
|
108 | + $path = $module->getPath().$this->langPath; |
|
109 | 109 | if (is_dir($path)) { |
110 | 110 | $files = array_merge($files, $this->laravel['files']->all($path)); |
111 | 111 | } |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | private function getDirectories($module) |
117 | 117 | { |
118 | 118 | $moduleName = $module->getStudlyName(); |
119 | - $path = $module->getPath() . '/Resources/lang'; |
|
119 | + $path = $module->getPath().'/Resources/lang'; |
|
120 | 120 | if (is_dir($path)) { |
121 | 121 | $directories = $this->laravel['files']->directories($path); |
122 | - $directories = array_map(function ($directory) use ($moduleName) { |
|
122 | + $directories = array_map(function($directory) use ($moduleName) { |
|
123 | 123 | return [ |
124 | 124 | 'name' => basename($directory), |
125 | 125 | 'module' => $moduleName, |
126 | 126 | 'path' => $directory, |
127 | - 'files' => array_map(function ($file) { |
|
127 | + 'files' => array_map(function($file) { |
|
128 | 128 | return basename($file); |
129 | - }, \File::glob($directory . DIRECTORY_SEPARATOR . "*")), |
|
129 | + }, \File::glob($directory.DIRECTORY_SEPARATOR."*")), |
|
130 | 130 | ]; |
131 | 131 | }, $directories); |
132 | 132 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | |
152 | 152 | $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values(); |
153 | 153 | |
154 | - $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
154 | + $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
155 | 155 | |
156 | 156 | $missingFiles = $uniqeLangFiles->diff($directory['files']); |
157 | 157 | |
158 | 158 | if ($missingFiles->count() > 0) { |
159 | - $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) { |
|
159 | + $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) { |
|
160 | 160 | $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}"; |
161 | 161 | }); |
162 | 162 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | if (count($missingFilesMessage) > 0) { |
167 | 167 | |
168 | - collect($missingFilesMessage)->each(function ($messages, $langDirectory) { |
|
168 | + collect($missingFilesMessage)->each(function($messages, $langDirectory) { |
|
169 | 169 | |
170 | 170 | $this->components->error("Missing language files in $langDirectory directory"); |
171 | 171 | |
@@ -189,22 +189,22 @@ discard block |
||
189 | 189 | |
190 | 190 | |
191 | 191 | $missingKeysMessage = []; |
192 | - $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
192 | + $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
193 | 193 | |
194 | - $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
195 | - $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file); |
|
194 | + $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
195 | + $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file); |
|
196 | 196 | |
197 | 197 | if ($langKeys == false) { |
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
201 | - $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
201 | + $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
202 | 202 | |
203 | 203 | if ($directory['name'] != $langDirectory) { |
204 | 204 | |
205 | 205 | $basePath = str_replace($directory['name'], $langDirectory, $directory['path']); |
206 | 206 | |
207 | - $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file); |
|
207 | + $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file); |
|
208 | 208 | |
209 | 209 | if ($otherLangKeys == false) { |
210 | 210 | return; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $missingKeys = $langKeys->diff($otherLangKeys); |
214 | 214 | if ($missingKeys->count() > 0) { |
215 | 215 | |
216 | - $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
216 | + $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
217 | 217 | $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey"; |
218 | 218 | }); |
219 | 219 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | if (count($missingKeysMessage) > 0) { |
228 | 228 | |
229 | - collect($missingKeysMessage)->each(function ($messages, $langDirectory) { |
|
229 | + collect($missingKeysMessage)->each(function($messages, $langDirectory) { |
|
230 | 230 | |
231 | 231 | $this->components->error("Missing language keys for directory $langDirectory:"); |
232 | 232 |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | use Illuminate\Foundation\Vite; |
4 | 4 | use Illuminate\Support\Facades\Vite as ViteFacade; |
5 | 5 | |
6 | -if (! function_exists('module_path')) { |
|
6 | +if (!function_exists('module_path')) { |
|
7 | 7 | function module_path($name, $path = '') |
8 | 8 | { |
9 | 9 | $module = app('modules')->find($name); |
10 | 10 | |
11 | - return $module->getPath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
11 | + return $module->getPath().($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | -if (! function_exists('config_path')) { |
|
15 | +if (!function_exists('config_path')) { |
|
16 | 16 | /** |
17 | 17 | * Get the configuration path. |
18 | 18 | * |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function config_path($path = '') |
23 | 23 | { |
24 | - return app()->basePath() . '/config' . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
24 | + return app()->basePath().'/config'.($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -if (! function_exists('public_path')) { |
|
28 | +if (!function_exists('public_path')) { |
|
29 | 29 | /** |
30 | 30 | * Get the path to the public folder. |
31 | 31 | * |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function public_path($path = '') |
36 | 36 | { |
37 | - return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
37 | + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if (! function_exists('module_vite')) { |
|
41 | +if (!function_exists('module_vite')) { |
|
42 | 42 | /** |
43 | 43 | * support for vite |
44 | 44 | */ |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | continue; |
360 | 360 | } |
361 | 361 | |
362 | - $path = $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . $folder->getPath(); |
|
362 | + $path = $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.$folder->getPath(); |
|
363 | 363 | |
364 | 364 | $this->filesystem->makeDirectory($path, 0755, true); |
365 | 365 | if (config('modules.stubs.gitkeep')) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function generateGitKeep($path) |
377 | 377 | { |
378 | - $this->filesystem->put($path . DIRECTORY_SEPARATOR . '.gitkeep', ''); |
|
378 | + $this->filesystem->put($path.DIRECTORY_SEPARATOR.'.gitkeep', ''); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | public function generateFiles() |
385 | 385 | { |
386 | 386 | foreach ($this->getFiles() as $stub => $file) { |
387 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
387 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
388 | 388 | |
389 | - $this->component->task("Generating file {$path}",function () use ($stub, $path) { |
|
389 | + $this->component->task("Generating file {$path}", function() use ($stub, $path) { |
|
390 | 390 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
391 | 391 | $this->filesystem->makeDirectory($dir, 0775, true); |
392 | 392 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | |
412 | 412 | if (GenerateConfigReader::read('provider')->generate() === true) { |
413 | 413 | $this->console->call('module:make-provider', [ |
414 | - 'name' => $this->getName() . 'ServiceProvider', |
|
414 | + 'name' => $this->getName().'ServiceProvider', |
|
415 | 415 | 'module' => $this->getName(), |
416 | 416 | '--master' => true, |
417 | 417 | ]); |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | if (GenerateConfigReader::read('controller')->generate() === true) { |
424 | - $options = $this->type=='api' ? ['--api'=>true] : []; |
|
424 | + $options = $this->type == 'api' ? ['--api'=>true] : []; |
|
425 | 425 | $this->console->call('module:make-controller', [ |
426 | - 'controller' => $this->getName() . 'Controller', |
|
426 | + 'controller' => $this->getName().'Controller', |
|
427 | 427 | 'module' => $this->getName(), |
428 | - ]+$options); |
|
428 | + ] + $options); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | protected function getStubContents($stub) |
440 | 440 | { |
441 | 441 | return (new Stub( |
442 | - DIRECTORY_SEPARATOR . $stub . '.stub', |
|
442 | + DIRECTORY_SEPARATOR.$stub.'.stub', |
|
443 | 443 | $this->getReplacement($stub) |
444 | 444 | ) |
445 | 445 | )->render(); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | foreach ($keys as $key) { |
481 | - if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) { |
|
481 | + if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) { |
|
482 | 482 | $replaces[$key] = $this->$method(); |
483 | 483 | } else { |
484 | 484 | $replaces[$key] = null; |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | */ |
494 | 494 | private function generateModuleJsonFile() |
495 | 495 | { |
496 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
496 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
497 | 497 | |
498 | - $this->component->task("Generating file $path",function () use ($path) { |
|
498 | + $this->component->task("Generating file $path", function() use ($path) { |
|
499 | 499 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
500 | 500 | $this->filesystem->makeDirectory($dir, 0775, true); |
501 | 501 | } |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | */ |
511 | 511 | private function cleanModuleJsonFile() |
512 | 512 | { |
513 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
513 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
514 | 514 | |
515 | 515 | $content = $this->filesystem->get($path); |
516 | 516 | $namespace = $this->getModuleNamespaceReplacement(); |
517 | 517 | $studlyName = $this->getStudlyNameReplacement(); |
518 | 518 | |
519 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"'; |
|
519 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"'; |
|
520 | 520 | |
521 | 521 | $content = str_replace($provider, '', $content); |
522 | 522 |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | $lowerName = $this->getLowerName(); |
185 | 185 | |
186 | - $langPath = $this->getPath() . '/Resources/lang'; |
|
186 | + $langPath = $this->getPath().'/Resources/lang'; |
|
187 | 187 | |
188 | 188 | if (is_dir($langPath)) { |
189 | 189 | $this->loadTranslationsFrom($langPath, $lowerName); |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $file = 'module.json'; |
204 | 204 | } |
205 | 205 | |
206 | - return Arr::get($this->moduleJson, $file, function () use ($file) { |
|
207 | - return $this->moduleJson[$file] = new Json($this->getPath() . DIRECTORY_SEPARATOR . $file, $this->files); |
|
206 | + return Arr::get($this->moduleJson, $file, function() use ($file) { |
|
207 | + return $this->moduleJson[$file] = new Json($this->getPath().DIRECTORY_SEPARATOR.$file, $this->files); |
|
208 | 208 | }); |
209 | 209 | } |
210 | 210 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | protected function fireEvent($event): void |
259 | 259 | { |
260 | - $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]); |
|
260 | + $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]); |
|
261 | 261 | } |
262 | 262 | /** |
263 | 263 | * Register the aliases from this module. |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | protected function registerFiles(): void |
283 | 283 | { |
284 | 284 | foreach ($this->get('files', []) as $file) { |
285 | - include $this->path . DIRECTORY_SEPARATOR . $file; |
|
285 | + include $this->path.DIRECTORY_SEPARATOR.$file; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function getExtraPath(string $path): string |
389 | 389 | { |
390 | - return $this->getPath() . DIRECTORY_SEPARATOR . $path; |
|
390 | + return $this->getPath().DIRECTORY_SEPARATOR.$path; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $module = $this->find($name); |
89 | 89 | |
90 | 90 | if ($module) { |
91 | - return $module->getPath() . DIRECTORY_SEPARATOR; |
|
91 | + return $module->getPath().DIRECTORY_SEPARATOR; |
|
92 | 92 | } |
93 | 93 | |
94 | - return $this->getPath() . DIRECTORY_SEPARATOR . Str::studly($name) . DIRECTORY_SEPARATOR; |
|
94 | + return $this->getPath().DIRECTORY_SEPARATOR.Str::studly($name).DIRECTORY_SEPARATOR; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getCached() |
143 | 143 | { |
144 | - return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
144 | + return $this->app['cache']->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
145 | 145 | return $this->getModel()->all(); |
146 | 146 | }); |
147 | 147 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $modules = []; |
219 | 219 | |
220 | 220 | foreach ($paths as $key => $path) { |
221 | - $manifests = $this->getFiles()->glob($path . DIRECTORY_SEPARATOR . 'module.json'); |
|
221 | + $manifests = $this->getFiles()->glob($path.DIRECTORY_SEPARATOR.'module.json'); |
|
222 | 222 | |
223 | 223 | is_array($manifests) || $manifests = []; |
224 | 224 | |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | |
254 | 254 | public function update($name) |
255 | 255 | { |
256 | - $module = $this->findOrFail($name); |
|
256 | + $module = $this->findOrFail($name); |
|
257 | 257 | $updater = new Updater($this); |
258 | 258 | if ($this->config('database_management.update_file_to_database_when_updating')) { |
259 | - $json = Json::make($module->getPath() . DIRECTORY_SEPARATOR . 'module.json'); |
|
259 | + $json = Json::make($module->getPath().DIRECTORY_SEPARATOR.'module.json'); |
|
260 | 260 | $data = $json->getAttributes(); |
261 | 261 | |
262 | 262 | if (!isset($data['version'])) { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $allows = $this->getModel()->getFillable(); |
289 | 289 | } |
290 | 290 | |
291 | - return array_filter($attributes, function ($k) use ($allows) { |
|
291 | + return array_filter($attributes, function($k) use ($allows) { |
|
292 | 292 | return in_array($k, $allows); |
293 | 293 | }, ARRAY_FILTER_USE_KEY); |
294 | 294 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | $modules = $this->allEnabled(); |
299 | 299 | |
300 | - uasort($modules, function (DatabaseModule $a, DatabaseModule $b) use ($direction) { |
|
300 | + uasort($modules, function(DatabaseModule $a, DatabaseModule $b) use ($direction) { |
|
301 | 301 | if ($a->get('priority') === $b->get('priority')) { |
302 | 302 | return 0; |
303 | 303 | } |