@@ -42,12 +42,12 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | protected function registerServices() |
| 44 | 44 | { |
| 45 | - $this->app->singleton(Contracts\RepositoryInterface::class, function ($app) { |
|
| 45 | + $this->app->singleton(Contracts\RepositoryInterface::class, function($app) { |
|
| 46 | 46 | $path = $app['config']->get('modules.paths.modules'); |
| 47 | 47 | |
| 48 | 48 | return new Lumen\LumenFileRepository($app, $path); |
| 49 | 49 | }); |
| 50 | - $this->app->singleton(Contracts\ActivatorInterface::class, function ($app) { |
|
| 50 | + $this->app->singleton(Contracts\ActivatorInterface::class, function($app) { |
|
| 51 | 51 | $activator = $app['config']->get('modules.activator'); |
| 52 | 52 | $class = $app['config']->get('modules.activators.'.$activator)['class']; |
| 53 | 53 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | $database = $this->option('database'); |
| 35 | 35 | |
| 36 | - if (! empty($database)) { |
|
| 36 | + if (!empty($database)) { |
|
| 37 | 37 | $migrator->setDatabase($database); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $paths = array_merge($paths, $this->config('scan.paths')); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $paths = array_map(function ($path) { |
|
| 121 | + $paths = array_map(function($path) { |
|
| 122 | 122 | return Str::endsWith($path, '/*') ? $path : Str::finish($path, '/*'); |
| 123 | 123 | }, $paths); |
| 124 | 124 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function scan() |
| 144 | 144 | { |
| 145 | - if (! empty(self::$modules) && ! $this->app->runningUnitTests()) { |
|
| 145 | + if (!empty(self::$modules) && !$this->app->runningUnitTests()) { |
|
| 146 | 146 | return self::$modules; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | { |
| 243 | 243 | $modules = $this->allEnabled(); |
| 244 | 244 | |
| 245 | - uasort($modules, function (Module $a, Module $b) use ($direction) { |
|
| 245 | + uasort($modules, function(Module $a, Module $b) use ($direction) { |
|
| 246 | 246 | if ($a->get('priority') === $b->get('priority')) { |
| 247 | 247 | return 0; |
| 248 | 248 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $path = storage_path('app/modules/modules.used'); |
| 365 | - if (! $this->getFiles()->exists($path)) { |
|
| 365 | + if (!$this->getFiles()->exists($path)) { |
|
| 366 | 366 | $this->getFiles()->put($path, ''); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function isDisabled(string $name): bool |
| 456 | 456 | { |
| 457 | - return ! $this->isEnabled($name); |
|
| 457 | + return !$this->isEnabled($name); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -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 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function config($key) |
| 102 | 102 | { |
| 103 | - return collect($this->getManifest())->flatMap(function ($configuration) use ($key) { |
|
| 104 | - return (array)($configuration[$key] ?? []); |
|
| 103 | + return collect($this->getManifest())->flatMap(function($configuration) use ($key) { |
|
| 104 | + return (array) ($configuration[$key] ?? []); |
|
| 105 | 105 | })->filter()->all(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function getManifest() |
| 114 | 114 | { |
| 115 | - if (! is_null($this->manifest)) { |
|
| 115 | + if (!is_null($this->manifest)) { |
|
| 116 | 116 | return $this->manifest; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if (! is_file($this->manifestPath)) { |
|
| 119 | + if (!is_file($this->manifestPath)) { |
|
| 120 | 120 | $this->build(); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function write(array $manifest): void |
| 157 | 157 | { |
| 158 | - if (! is_writable($dirname = dirname($this->manifestPath))) { |
|
| 158 | + if (!is_writable($dirname = dirname($this->manifestPath))) { |
|
| 159 | 159 | throw new Exception("The {$dirname} directory must be present and writable."); |
| 160 | 160 | } |
| 161 | 161 | $this->files->replace( |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | //todo check this section store on module.php or not? |
| 170 | 170 | $this->getModulesData() |
| 171 | - ->each(function (array $manifest) { |
|
| 171 | + ->each(function(array $manifest) { |
|
| 172 | 172 | if (empty($manifest['files'])) { |
| 173 | 173 | return; |
| 174 | 174 | } |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | public function getModulesData(): Collection |
| 183 | 183 | { |
| 184 | - if (! empty(self::$manifestData) && ! app()->runningUnitTests()) { |
|
| 184 | + if (!empty(self::$manifestData) && !app()->runningUnitTests()) { |
|
| 185 | 185 | return self::$manifestData; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | self::$manifestData = $this->paths |
| 189 | - ->flatMap(function ($path) { |
|
| 189 | + ->flatMap(function($path) { |
|
| 190 | 190 | $manifests = $this->files->glob("{$path}/module.json"); |
| 191 | 191 | is_array($manifests) || $manifests = []; |
| 192 | 192 | |
| 193 | 193 | return collect($manifests) |
| 194 | - ->map(function ($manifest) { |
|
| 194 | + ->map(function($manifest) { |
|
| 195 | 195 | return [ |
| 196 | 196 | 'module_directory' => dirname($manifest), |
| 197 | 197 | ...$this->files->json($manifest), |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function handle(): int |
| 30 | 30 | { |
| 31 | 31 | $appFolder = config('modules.paths.app_folder', 'app/'); |
| 32 | - $appFolder = rtrim($appFolder, '/') . '/'; |
|
| 32 | + $appFolder = rtrim($appFolder, '/').'/'; |
|
| 33 | 33 | $phpunitXmlPath = base_path('phpunit.xml'); |
| 34 | 34 | $modulesStatusPath = base_path('modules_statuses.json'); |
| 35 | 35 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $enabledModules = json_decode(file_get_contents($modulesStatusPath), true); |
| 47 | 47 | |
| 48 | 48 | if (json_last_error() !== JSON_ERROR_NONE) { |
| 49 | - $this->error("Error decoding JSON from {$modulesStatusPath}: " . json_last_error_msg()); |
|
| 49 | + $this->error("Error decoding JSON from {$modulesStatusPath}: ".json_last_error_msg()); |
|
| 50 | 50 | return 98; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | foreach ($enabledModules as $module => $status) { |
| 57 | 57 | if ($status) { // Only add enabled modules |
| 58 | - $moduleDir = $modulesPath . $module . '/' . $appFolder; |
|
| 58 | + $moduleDir = $modulesPath.$module.'/'.$appFolder; |
|
| 59 | 59 | if (is_dir($moduleDir)) { |
| 60 | 60 | $moduleDirs[] = $moduleDir; |
| 61 | 61 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | /** |
| 265 | 265 | * Set force status. |
| 266 | 266 | */ |
| 267 | - public function setForce(bool|int $force): self |
|
| 267 | + public function setForce(bool | int $force): self |
|
| 268 | 268 | { |
| 269 | 269 | $this->force = $force; |
| 270 | 270 | |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | foreach ($this->getFiles() as $stub => $file) { |
| 354 | 354 | $path = $this->module->getModulePath($this->getName()).$file; |
| 355 | 355 | |
| 356 | - $this->component->task("Generating file {$path}", function () use ($stub, $path) { |
|
| 357 | - if (! $this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 356 | + $this->component->task("Generating file {$path}", function() use ($stub, $path) { |
|
| 357 | + if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 358 | 358 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 359 | 359 | } |
| 360 | 360 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $eventGeneratorConfig = GenerateConfigReader::read('event-provider'); |
| 397 | 397 | if ( |
| 398 | 398 | (is_null($eventGeneratorConfig->getPath()) && $providerGenerator->generate()) |
| 399 | - || (! is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate()) |
|
| 399 | + || (!is_null($eventGeneratorConfig->getPath()) && $eventGeneratorConfig->generate()) |
|
| 400 | 400 | ) { |
| 401 | 401 | $this->console->call('module:make-event-provider', [ |
| 402 | 402 | 'module' => $this->getName(), |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $routeGeneratorConfig = GenerateConfigReader::read('route-provider'); |
| 416 | 416 | if ( |
| 417 | 417 | (is_null($routeGeneratorConfig->getPath()) && $providerGenerator->generate()) |
| 418 | - || (! is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate()) |
|
| 418 | + || (!is_null($routeGeneratorConfig->getPath()) && $routeGeneratorConfig->generate()) |
|
| 419 | 419 | ) { |
| 420 | 420 | $this->console->call('module:route-provider', [ |
| 421 | 421 | 'module' => $this->getName(), |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | { |
| 468 | 468 | $replacements = $this->module->config('stubs.replacements'); |
| 469 | 469 | |
| 470 | - if (! isset($replacements['composer']['APP_FOLDER_NAME'])) { |
|
| 470 | + if (!isset($replacements['composer']['APP_FOLDER_NAME'])) { |
|
| 471 | 471 | $replacements['composer'][] = 'APP_FOLDER_NAME'; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - if (! isset($replacements[$stub])) { |
|
| 474 | + if (!isset($replacements[$stub])) { |
|
| 475 | 475 | return []; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) { |
| 489 | 489 | $replace = $this->$method(); |
| 490 | 490 | |
| 491 | - if($stub === 'routes/web' || $stub === 'routes/api' ){ |
|
| 491 | + if ($stub === 'routes/web' || $stub === 'routes/api') { |
|
| 492 | 492 | $replace = str_replace('\\\\', '\\', $replace); |
| 493 | 493 | } |
| 494 | 494 | |
@@ -509,8 +509,8 @@ discard block |
||
| 509 | 509 | { |
| 510 | 510 | $path = $this->module->getModulePath($this->getName()).'module.json'; |
| 511 | 511 | |
| 512 | - $this->component->task("Generating file $path", function () use ($path) { |
|
| 513 | - if (! $this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 512 | + $this->component->task("Generating file $path", function() use ($path) { |
|
| 513 | + if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 514 | 514 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -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 | /** |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function getExtraPath(?string $path): string |
| 386 | 386 | { |
| 387 | - return $this->getPath() . ($path ? '/' . $path : ''); |
|
| 387 | + return $this->getPath().($path ? '/'.$path : ''); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
@@ -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 | /** |