@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | 'NAMESPACE' => $this->getClassNamespace($module), |
| 81 | 81 | 'CLASS' => $this->getClass(), |
| 82 | 82 | 'LOWER_NAME' => $module->getLowerName(), |
| 83 | - 'COMPONENT_NAME' => 'components.' . Str::lower($this->argument('name')), |
|
| 83 | + 'COMPONENT_NAME' => 'components.'.Str::lower($this->argument('name')), |
|
| 84 | 84 | ]))->render(); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
| 93 | 93 | $factoryPath = GenerateConfigReader::read('component-class'); |
| 94 | 94 | |
| 95 | - return $path . $factoryPath->getPath() . '/' . $this->getFileName(); |
|
| 95 | + return $path.$factoryPath->getPath().'/'.$this->getFileName(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -100,6 +100,6 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | private function getFileName() |
| 102 | 102 | { |
| 103 | - return Str::studly($this->argument('name')) . '.php'; |
|
| 103 | + return Str::studly($this->argument('name')).'.php'; |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $generatorPath = GenerateConfigReader::read('provider'); |
| 89 | 89 | |
| 90 | - return $path . $generatorPath->getPath() . '/' . $this->getFileName() . '.php'; |
|
| 90 | + return $path.$generatorPath->getPath().'/'.$this->getFileName().'.php'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function getWebRoutesPath() |
| 97 | 97 | { |
| 98 | - return '/' . $this->laravel['modules']->config('stubs.files.routes/web', 'routes/web.php'); |
|
| 98 | + return '/'.$this->laravel['modules']->config('stubs.files.routes/web', 'routes/web.php'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function getApiRoutesPath() |
| 105 | 105 | { |
| 106 | - return '/' . $this->laravel['modules']->config('stubs.files.routes/api', 'routes/api.php'); |
|
| 106 | + return '/'.$this->laravel['modules']->config('stubs.files.routes/api', 'routes/api.php'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function getDefaultNamespace(): string |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $path = $this->laravel['modules']->config('paths.generator.model.path', 'app/Models'); |
| 72 | 72 | |
| 73 | - return $this->getPathNamespace($this->laravel['modules']->config('namespace') . '\\' . $this->laravel['modules']->findOrFail($this->getModuleName()) . '\\' . $path); |
|
| 73 | + return $this->getPathNamespace($this->laravel['modules']->config('namespace').'\\'.$this->laravel['modules']->findOrFail($this->getModuleName()).'\\'.$path); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function getModelVariable(): string |
| 88 | 88 | { |
| 89 | - return '$' . Str::lower($this->argument('name')); |
|
| 89 | + return '$'.Str::lower($this->argument('name')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $observerPath = GenerateConfigReader::read('observer'); |
| 100 | 100 | |
| 101 | - return $path . $observerPath->getPath() . '/' . $this->getFileName(); |
|
| 101 | + return $path.$observerPath->getPath().'/'.$this->getFileName(); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | private function getFileName() |
| 108 | 108 | { |
| 109 | - return Str::studly($this->argument('name')) . 'Observer.php'; |
|
| 109 | + return Str::studly($this->argument('name')).'Observer.php'; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function handle(): int |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | $channelPath = GenerateConfigReader::read('channels'); |
| 53 | 53 | |
| 54 | - return $path . $channelPath->getPath() . '/' . $this->getFileName() . '.php'; |
|
| 54 | + return $path.$channelPath->getPath().'/'.$this->getFileName().'.php'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | private function getFileName(): string |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | |
| 75 | 75 | $rulePath = GenerateConfigReader::read('rules'); |
| 76 | 76 | |
| 77 | - return $path . $rulePath->getPath() . '/' . $this->getFileName() . '.php'; |
|
| 77 | + return $path.$rulePath->getPath().'/'.$this->getFileName().'.php'; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | private function getFileName(): string |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $contents = $this->getTemplateContents(); |
| 45 | 45 | |
| 46 | 46 | try { |
| 47 | - $this->components->task("Generating file {$path}", function () use ($path, $contents) { |
|
| 47 | + $this->components->task("Generating file {$path}", function() use ($path, $contents) { |
|
| 48 | 48 | $overwriteFile = $this->hasOption('force') ? $this->option('force') : false; |
| 49 | 49 | (new FileGenerator($path, $contents))->withFileOverwrite($overwriteFile)->generate(); |
| 50 | 50 | }); |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $namespace = $this->laravel['modules']->config('namespace'); |
| 94 | 94 | |
| 95 | - $namespace .= '\\' . $module->getStudlyName(); |
|
| 95 | + $namespace .= '\\'.$module->getStudlyName(); |
|
| 96 | 96 | |
| 97 | - $namespace .= '\\' . $this->getDefaultNamespace(); |
|
| 97 | + $namespace .= '\\'.$this->getDefaultNamespace(); |
|
| 98 | 98 | |
| 99 | - $namespace .= '\\' . $extra; |
|
| 99 | + $namespace .= '\\'.$extra; |
|
| 100 | 100 | |
| 101 | 101 | $namespace = str_replace('/', '\\', $namespace); |
| 102 | 102 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | public function getModuleNamespace(string $path = null, string $module = null): string |
| 122 | 122 | { |
| 123 | 123 | return $this->getStudlyNamespace( |
| 124 | - $this->laravel['modules']->config('namespace') . '\\' |
|
| 125 | - . ($module ?? $this->laravel['modules']->findOrFail($this->getModuleName())) . '\\' |
|
| 124 | + $this->laravel['modules']->config('namespace').'\\' |
|
| 125 | + . ($module ?? $this->laravel['modules']->findOrFail($this->getModuleName())).'\\' |
|
| 126 | 126 | . $this->getPathNamespace($path) |
| 127 | 127 | ); |
| 128 | 128 | } |
@@ -55,12 +55,12 @@ |
||
| 55 | 55 | |
| 56 | 56 | $factoryPath = GenerateConfigReader::read('factory'); |
| 57 | 57 | |
| 58 | - return $path . $factoryPath->getPath() . '/' . $this->getFileName(); |
|
| 58 | + return $path.$factoryPath->getPath().'/'.$this->getFileName(); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private function getFileName(): string |
| 62 | 62 | { |
| 63 | - return Str::studly($this->argument('name')) . 'Factory.php'; |
|
| 63 | + return Str::studly($this->argument('name')).'Factory.php'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | private function getModelName(): string |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | protected function getEventName(Module $module) |
| 77 | 77 | { |
| 78 | - $namespace = $this->laravel['modules']->config('namespace') . "\\" . $module->getStudlyName(); |
|
| 78 | + $namespace = $this->laravel['modules']->config('namespace')."\\".$module->getStudlyName(); |
|
| 79 | 79 | $eventPath = GenerateConfigReader::read('event'); |
| 80 | 80 | |
| 81 | - return $this->getPathNamespace($namespace . "\\" . $eventPath->getPath() . "\\" . $this->option('event')); |
|
| 81 | + return $this->getPathNamespace($namespace."\\".$eventPath->getPath()."\\".$this->option('event')); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | protected function getShortEventName() |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $listenerPath = GenerateConfigReader::read('listener'); |
| 94 | 94 | |
| 95 | - return $path . $listenerPath->getPath() . '/' . $this->getFileName() . '.php'; |
|
| 95 | + return $path.$listenerPath->getPath().'/'.$this->getFileName().'.php'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | /** |
| 326 | 326 | * Set force status. |
| 327 | 327 | */ |
| 328 | - public function setForce(bool|int $force): self |
|
| 328 | + public function setForce(bool | int $force): self |
|
| 329 | 329 | { |
| 330 | 330 | $this->force = $force; |
| 331 | 331 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | continue; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $path = $this->module->getModulePath($this->getName()) . '/' . $folder->getPath(); |
|
| 387 | + $path = $this->module->getModulePath($this->getName()).'/'.$folder->getPath(); |
|
| 388 | 388 | |
| 389 | 389 | $this->filesystem->ensureDirectoryExists($path, 0755, true); |
| 390 | 390 | if (config('modules.stubs.gitkeep')) { |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function generateGitKeep(string $path) |
| 400 | 400 | { |
| 401 | - $this->filesystem->put($path . '/.gitkeep', ''); |
|
| 401 | + $this->filesystem->put($path.'/.gitkeep', ''); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /** |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | public function generateFiles() |
| 408 | 408 | { |
| 409 | 409 | foreach ($this->getFiles() as $stub => $file) { |
| 410 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
| 410 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
| 411 | 411 | |
| 412 | - $this->component->task("Generating file {$path}", function () use ($stub, $path) { |
|
| 412 | + $this->component->task("Generating file {$path}", function() use ($stub, $path) { |
|
| 413 | 413 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 414 | 414 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 415 | 415 | } |
@@ -435,14 +435,14 @@ discard block |
||
| 435 | 435 | $providerGenerator = GenerateConfigReader::read('provider'); |
| 436 | 436 | if ($providerGenerator->generate() === true) { |
| 437 | 437 | $this->console->call('module:make-provider', [ |
| 438 | - 'name' => $this->getName() . 'ServiceProvider', |
|
| 438 | + 'name' => $this->getName().'ServiceProvider', |
|
| 439 | 439 | 'module' => $this->getName(), |
| 440 | 440 | '--master' => true, |
| 441 | 441 | ]); |
| 442 | 442 | } else { |
| 443 | 443 | // delete register ServiceProvider on module.json |
| 444 | - $path = $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . 'module.json'; |
|
| 445 | - $module_file = $this->filesystem->get($path); |
|
| 444 | + $path = $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.'module.json'; |
|
| 445 | + $module_file = $this->filesystem->get($path); |
|
| 446 | 446 | $this->filesystem->put( |
| 447 | 447 | $path, |
| 448 | 448 | preg_replace('/"providers": \[.*?\],/s', '"providers": [ ],', $module_file) |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $this->filesystem->replaceInFile( |
| 464 | 464 | '$this->app->register(Route', |
| 465 | 465 | '// $this->app->register(Route', |
| 466 | - $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . $providerGenerator->getPath() . DIRECTORY_SEPARATOR . sprintf('%sServiceProvider.php', $this->getName()) |
|
| 466 | + $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.$providerGenerator->getPath().DIRECTORY_SEPARATOR.sprintf('%sServiceProvider.php', $this->getName()) |
|
| 467 | 467 | ); |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | if (GenerateConfigReader::read('controller')->generate() === true) { |
| 472 | 472 | $options = $this->type == 'api' ? ['--api' => true] : []; |
| 473 | 473 | $this->console->call('module:make-controller', [ |
| 474 | - 'controller' => $this->getName() . 'Controller', |
|
| 474 | + 'controller' => $this->getName().'Controller', |
|
| 475 | 475 | 'module' => $this->getName(), |
| 476 | 476 | ] + $options); |
| 477 | 477 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | protected function getStubContents($stub): string |
| 484 | 484 | { |
| 485 | 485 | return (new Stub( |
| 486 | - '/' . $stub . '.stub', |
|
| 486 | + '/'.$stub.'.stub', |
|
| 487 | 487 | $this->getReplacement($stub) |
| 488 | 488 | ) |
| 489 | 489 | )->render(); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | foreach ($keys as $key) { |
| 522 | - if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) { |
|
| 522 | + if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) { |
|
| 523 | 523 | $replaces[$key] = $this->$method(); |
| 524 | 524 | } else { |
| 525 | 525 | $replaces[$key] = null; |
@@ -534,9 +534,9 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | private function generateModuleJsonFile() |
| 536 | 536 | { |
| 537 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 537 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 538 | 538 | |
| 539 | - $this->component->task("Generating file $path", function () use ($path) { |
|
| 539 | + $this->component->task("Generating file $path", function() use ($path) { |
|
| 540 | 540 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 541 | 541 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 542 | 542 | } |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | private function cleanModuleJsonFile() |
| 553 | 553 | { |
| 554 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 554 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 555 | 555 | |
| 556 | 556 | $content = $this->filesystem->get($path); |
| 557 | 557 | $namespace = $this->getModuleNamespaceReplacement(); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | $class = "{$studlyName}ServiceProvider"; |
| 560 | 560 | |
| 561 | 561 | $provider_namespace = str_replace('\\', '\\\\', config('modules.paths.generator.provider.namespace') ?? $this->getPathNamespace(config('modules.paths.generator.provider.path', 'app/Providers'))); |
| 562 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\' . $provider_namespace . '\\\\' . $class . '"'; |
|
| 562 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\'.$provider_namespace.'\\\\'.$class.'"'; |
|
| 563 | 563 | |
| 564 | 564 | $content = str_replace($provider, '', $content); |
| 565 | 565 | |