@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $lowerName = $this->getLowerName(); |
| 205 | 205 | |
| 206 | - $langPath = $this->getPath() . '/Resources/lang'; |
|
| 206 | + $langPath = $this->getPath().'/Resources/lang'; |
|
| 207 | 207 | |
| 208 | 208 | if (is_dir($langPath)) { |
| 209 | 209 | $this->loadTranslationsFrom($langPath, $lowerName); |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | $file = 'module.json'; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - return Arr::get($this->moduleJson, $file, function () use ($file) { |
|
| 227 | - return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->files); |
|
| 226 | + return Arr::get($this->moduleJson, $file, function() use ($file) { |
|
| 227 | + return $this->moduleJson[$file] = new Json($this->getPath().'/'.$file, $this->files); |
|
| 228 | 228 | }); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | protected function fireEvent($event): void |
| 279 | 279 | { |
| 280 | - $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]); |
|
| 280 | + $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]); |
|
| 281 | 281 | } |
| 282 | 282 | /** |
| 283 | 283 | * Register the aliases from this module. |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | protected function registerFiles(): void |
| 303 | 303 | { |
| 304 | 304 | foreach ($this->get('files', []) as $file) { |
| 305 | - include $this->path . '/' . $file; |
|
| 305 | + include $this->path.'/'.$file; |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | public function getExtraPath(string $path): string |
| 409 | 409 | { |
| 410 | - return $this->getPath() . '/' . $path; |
|
| 410 | + return $this->getPath().'/'.$path; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | return $this->readJson(); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->cacheKey, $this->cacheLifetime, function () { |
|
| 186 | + return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->cacheKey, $this->cacheLifetime, function() { |
|
| 187 | 187 | return $this->readJson(); |
| 188 | 188 | }); |
| 189 | 189 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | private function config(string $key, $default = null) |
| 199 | 199 | { |
| 200 | - return $this->config->get('modules.activators.file.' . $key, $default); |
|
| 200 | + return $this->config->get('modules.activators.file.'.$key, $default); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $paths = array_merge($paths, $this->config('scan.paths')); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $paths = array_map(function ($path) { |
|
| 119 | + $paths = array_map(function($path) { |
|
| 120 | 120 | return Str::endsWith($path, '/*') ? $path : Str::finish($path, '/*'); |
| 121 | 121 | }, $paths); |
| 122 | 122 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function getCached() |
| 202 | 202 | { |
| 203 | - return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
| 203 | + return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
| 204 | 204 | return $this->toCollection()->toArray(); |
| 205 | 205 | }); |
| 206 | 206 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $modules = $this->allEnabled(); |
| 291 | 291 | |
| 292 | - uasort($modules, function (Module $a, Module $b) use ($direction) { |
|
| 292 | + uasort($modules, function(Module $a, Module $b) use ($direction) { |
|
| 293 | 293 | if ($a->get('priority') === $b->get('priority')) { |
| 294 | 294 | return 0; |
| 295 | 295 | } |
@@ -418,9 +418,9 @@ discard block |
||
| 418 | 418 | public function getModulePath($module) |
| 419 | 419 | { |
| 420 | 420 | try { |
| 421 | - return $this->findOrFail($module)->getPath() . '/'; |
|
| 421 | + return $this->findOrFail($module)->getPath().'/'; |
|
| 422 | 422 | } catch (ModuleNotFoundException $e) { |
| 423 | - return $this->getPath() . '/' . Str::studly($module) . '/'; |
|
| 423 | + return $this->getPath().'/'.Str::studly($module).'/'; |
|
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | public function assetPath(string $module): string |
| 431 | 431 | { |
| 432 | - return $this->config('paths.assets') . '/' . $module; |
|
| 432 | + return $this->config('paths.assets').'/'.$module; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | public function config(string $key, $default = null) |
| 439 | 439 | { |
| 440 | - return $this->config->get('modules.' . $key, $default); |
|
| 440 | + return $this->config->get('modules.'.$key, $default); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
@@ -527,9 +527,9 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | list($name, $url) = explode(':', $asset); |
| 529 | 529 | |
| 530 | - $baseUrl = str_replace(public_path() . DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 530 | + $baseUrl = str_replace(public_path().DIRECTORY_SEPARATOR, '', $this->getAssetsPath()); |
|
| 531 | 531 | |
| 532 | - $url = $this->url->asset($baseUrl . "/{$name}/" . $url); |
|
| 532 | + $url = $this->url->asset($baseUrl."/{$name}/".$url); |
|
| 533 | 533 | |
| 534 | 534 | return str_replace(['http://', 'https://'], '//', $url); |
| 535 | 535 | } |
@@ -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 | */ |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function decodeContents() |
| 122 | 122 | { |
| 123 | - $attributes = json_decode($this->getContents(), 1); |
|
| 123 | + $attributes = json_decode($this->getContents(), 1); |
|
| 124 | 124 | |
| 125 | 125 | // any JSON parsing errors should throw an exception |
| 126 | 126 | if (json_last_error() > 0) { |
| 127 | - throw new InvalidJsonException('Error processing file: ' . $this->getPath() . '. Error: ' . json_last_error_msg()); |
|
| 127 | + throw new InvalidJsonException('Error processing file: '.$this->getPath().'. Error: '.json_last_error_msg()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return $attributes; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | return $this->decodeContents(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function () { |
|
| 145 | + return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function() { |
|
| 146 | 146 | return $this->decodeContents(); |
| 147 | 147 | }); |
| 148 | 148 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | public function getMigrations($reverse = false) |
| 100 | 100 | { |
| 101 | 101 | if (!empty($this->subpath)) { |
| 102 | - $files = $this->laravel['files']->glob($this->getPath() . '/' . $this->subpath); |
|
| 102 | + $files = $this->laravel['files']->glob($this->getPath().'/'.$this->subpath); |
|
| 103 | 103 | } else { |
| 104 | - $files = $this->laravel['files']->glob($this->getPath() . '/*_*.php'); |
|
| 104 | + $files = $this->laravel['files']->glob($this->getPath().'/*_*.php'); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Once we have the array of files in the directory we will just remove the |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | return []; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $files = array_map(function ($file) { |
|
| 114 | + $files = array_map(function($file) { |
|
| 115 | 115 | return str_replace('.php', '', basename($file)); |
| 116 | 116 | }, $files); |
| 117 | 117 | |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $class = Str::studly($name); |
| 218 | 218 | |
| 219 | - if (!class_exists($class) && file_exists($this->getPath() . '/' . $file . '.php')) { |
|
| 220 | - return include $this->getPath() . '/' . $file . '.php'; |
|
| 219 | + if (!class_exists($class) && file_exists($this->getPath().'/'.$file.'.php')) { |
|
| 220 | + return include $this->getPath().'/'.$file.'.php'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return new $class(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | $path = $this->getPath(); |
| 234 | 234 | foreach ($files as $file) { |
| 235 | - $this->laravel['files']->requireOnce($path . '/' . $file . '.php'); |
|
| 235 | + $this->laravel['files']->requireOnce($path.'/'.$file.'.php'); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | $result = $query->orderBy('migration', 'desc')->get(); |
| 317 | 317 | |
| 318 | - return collect($result)->map(function ($item) { |
|
| 318 | + return collect($result)->map(function($item) { |
|
| 319 | 319 | return (array) $item; |
| 320 | 320 | })->pluck('migration'); |
| 321 | 321 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | abstract function executeAction($name); |
| 41 | 41 | |
| 42 | - public function getInfo(): string|null |
|
| 42 | + public function getInfo(): string | null |
|
| 43 | 43 | { |
| 44 | 44 | return NULL; |
| 45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function handle() |
| 51 | 51 | { |
| 52 | - if (! is_null($info = $this->getInfo())) { |
|
| 52 | + if (!is_null($info = $this->getInfo())) { |
|
| 53 | 53 | $this->components->info($info); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if (! empty($input->getArgument('module'))) { |
|
| 72 | + if (!empty($input->getArgument('module'))) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | continue; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $path = $this->module->getModulePath($this->getName()) . '/' . $folder->getPath(); |
|
| 362 | + $path = $this->module->getModulePath($this->getName()).'/'.$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 . '/.gitkeep', ''); |
|
| 378 | + $this->filesystem->put($path.'/.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 | - '/' . $stub . '.stub', |
|
| 442 | + '/'.$stub.'.stub', |
|
| 443 | 443 | $this->getReplacement($stub) |
| 444 | 444 | ) |
| 445 | 445 | )->render(); |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | foreach ($keys as $key) { |
| 483 | - if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) { |
|
| 483 | + if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) { |
|
| 484 | 484 | $replaces[$key] = $this->$method(); |
| 485 | 485 | } else { |
| 486 | 486 | $replaces[$key] = null; |
@@ -495,9 +495,9 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | private function generateModuleJsonFile() |
| 497 | 497 | { |
| 498 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 498 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 499 | 499 | |
| 500 | - $this->component->task("Generating file $path",function () use ($path) { |
|
| 500 | + $this->component->task("Generating file $path", function() use ($path) { |
|
| 501 | 501 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 502 | 502 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 503 | 503 | } |
@@ -512,13 +512,13 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | private function cleanModuleJsonFile() |
| 514 | 514 | { |
| 515 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 515 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 516 | 516 | |
| 517 | 517 | $content = $this->filesystem->get($path); |
| 518 | 518 | $namespace = $this->getModuleNamespaceReplacement(); |
| 519 | 519 | $studlyName = $this->getStudlyNameReplacement(); |
| 520 | 520 | |
| 521 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"'; |
|
| 521 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"'; |
|
| 522 | 522 | |
| 523 | 523 | $content = str_replace($provider, '', $content); |
| 524 | 524 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | */ |
| 573 | 573 | private function getControllerNamespaceReplacement(): string |
| 574 | 574 | { |
| 575 | - return str_replace('/', '\\', $this->module->config('paths.generator.controller.namespace') ?: ltrim($this->module->config('paths.generator.controller.path', 'Controller'),config('modules.paths.app_folder'))); |
|
| 575 | + return str_replace('/', '\\', $this->module->config('paths.generator.controller.namespace') ?: ltrim($this->module->config('paths.generator.controller.path', 'Controller'), config('modules.paths.app_folder'))); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $module = $this->getModuleModel($name); |
| 26 | 26 | |
| 27 | - $this->components->task("Updating Composer.json <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 27 | + $this->components->task("Updating Composer.json <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 28 | 28 | |
| 29 | - $composer_path = $module->getPath() . DIRECTORY_SEPARATOR . 'composer.json'; |
|
| 29 | + $composer_path = $module->getPath().DIRECTORY_SEPARATOR.'composer.json'; |
|
| 30 | 30 | |
| 31 | 31 | $composer = json_decode(File::get($composer_path), TRUE); |
| 32 | 32 | |
| 33 | 33 | $autoload = data_get($composer, 'autoload.psr-4'); |
| 34 | 34 | |
| 35 | - if (! $autoload) { |
|
| 35 | + if (!$autoload) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $key_name_with_app = sprintf('Modules\\%s\\App\\', $module->getStudlyName()); |
| 40 | 40 | |
| 41 | - if (! array_key_exists($key_name_with_app, $autoload) ) { |
|
| 41 | + if (!array_key_exists($key_name_with_app, $autoload)) { |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | }); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - function getInfo(): string|null |
|
| 56 | + function getInfo(): string | null |
|
| 57 | 57 | { |
| 58 | 58 | return 'Updating Composer.json of modules...'; |
| 59 | 59 | } |