@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $contents = $this->getTemplateContents(); |
| 44 | 44 | |
| 45 | 45 | try { |
| 46 | - $this->components->task("Generating file {$path}",function () use ($path,$contents) { |
|
| 46 | + $this->components->task("Generating file {$path}", function() use ($path, $contents) { |
|
| 47 | 47 | $overwriteFile = $this->hasOption('force') ? $this->option('force') : false; |
| 48 | 48 | (new FileGenerator($path, $contents))->withFileOverwrite($overwriteFile)->generate(); |
| 49 | 49 | }); |
@@ -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 | |
@@ -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 | } |
@@ -60,11 +60,11 @@ |
||
| 60 | 60 | |
| 61 | 61 | if ($name instanceof Module) { |
| 62 | 62 | $module = $name; |
| 63 | - }else { |
|
| 63 | + } else { |
|
| 64 | 64 | $module = $this->laravel['modules']->findOrFail($name); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->components->task("Updating {$module->getName()} module", function () use ($module) { |
|
| 67 | + $this->components->task("Updating {$module->getName()} module", function() use ($module) { |
|
| 68 | 68 | $this->laravel['modules']->update($module); |
| 69 | 69 | }); |
| 70 | 70 | $this->laravel['modules']->update($name); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $this->components->info('Disabling module ...'); |
| 31 | 31 | |
| 32 | - if ($name = $this->argument('module') ) { |
|
| 32 | + if ($name = $this->argument('module')) { |
|
| 33 | 33 | $this->disable($name); |
| 34 | 34 | |
| 35 | 35 | return 0; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | if ($name instanceof Module) { |
| 67 | 67 | $module = $name; |
| 68 | - }else { |
|
| 68 | + } else { |
|
| 69 | 69 | $module = $this->laravel['modules']->findOrFail($name); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $this->components->info('Enabling module ...'); |
| 32 | 32 | |
| 33 | - if ($name = $this->argument('module') ) { |
|
| 33 | + if ($name = $this->argument('module')) { |
|
| 34 | 34 | $this->enable($name); |
| 35 | 35 | |
| 36 | 36 | return 0; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | if ($name instanceof Module) { |
| 68 | 68 | $module = $name; |
| 69 | - }else { |
|
| 69 | + } else { |
|
| 70 | 70 | $module = $this->laravel['modules']->findOrFail($name); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $module->enable(); |
| 75 | 75 | |
| 76 | 76 | $this->components->info("Module [{$module}] enabled successful."); |
| 77 | - }else { |
|
| 77 | + } else { |
|
| 78 | 78 | $this->components->warn("Module [{$module}] has already enabled."); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $this->components->info('Generating optimized autoload modules.'); |
| 31 | 31 | |
| 32 | - if ($name = $this->argument('module') ) { |
|
| 32 | + if ($name = $this->argument('module')) { |
|
| 33 | 33 | $this->dump($name); |
| 34 | 34 | |
| 35 | 35 | return 0; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $module = $this->laravel['modules']->findOrFail($name); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $this->components->task("$module", function () use ($module) { |
|
| 66 | + $this->components->task("$module", function() use ($module) { |
|
| 67 | 67 | chdir($module->getPath()); |
| 68 | 68 | |
| 69 | 69 | passthru('composer dump -o -n -q'); |
@@ -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 | |