@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | $lowerName = $this->getLowerName(); |
| 225 | 225 | |
| 226 | - $langPath = $this->getPath() . '/Resources/lang'; |
|
| 226 | + $langPath = $this->getPath().'/Resources/lang'; |
|
| 227 | 227 | |
| 228 | 228 | if (is_dir($langPath)) { |
| 229 | 229 | $this->loadTranslationsFrom($langPath, $lowerName); |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | $file = 'module.json'; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - return Arr::get($this->moduleJson, $file, function () use ($file) { |
|
| 247 | - return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->files); |
|
| 246 | + return Arr::get($this->moduleJson, $file, function() use ($file) { |
|
| 247 | + return $this->moduleJson[$file] = new Json($this->getPath().'/'.$file, $this->files); |
|
| 248 | 248 | }); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function fireEvent($event): void |
| 299 | 299 | { |
| 300 | - $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]); |
|
| 300 | + $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | protected function registerFiles(): void |
| 324 | 324 | { |
| 325 | 325 | foreach ($this->get('files', []) as $file) { |
| 326 | - include $this->path . '/' . $file; |
|
| 326 | + include $this->path.'/'.$file; |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function getExtraPath(string $path): string |
| 430 | 430 | { |
| 431 | - return $this->getPath() . '/' . $path; |
|
| 431 | + return $this->getPath().'/'.$path; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -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 | - public function getInfo(): string|null |
|
| 56 | + public function getInfo(): string | null |
|
| 57 | 57 | { |
| 58 | 58 | return 'Updating Composer.json of modules...'; |
| 59 | 59 | } |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $module = $this->getModuleModel($name); |
| 24 | 24 | |
| 25 | - $this->components->task("Updating <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 25 | + $this->components->task("Updating <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 26 | 26 | $this->laravel['modules']->update($module); |
| 27 | 27 | }); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function getInfo(): string|null |
|
| 30 | + public function getInfo(): string | null |
|
| 31 | 31 | { |
| 32 | 32 | return 'Updating Module ...'; |
| 33 | 33 | } |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | ? '<fg=red;options=bold>Disabled</>' |
| 34 | 34 | : '<fg=green;options=bold>Enabled</>'; |
| 35 | 35 | |
| 36 | - $this->components->task("Disabling <fg=cyan;options=bold>{$module->getName()}</> Module, old status: $status", function () use ($module) { |
|
| 36 | + $this->components->task("Disabling <fg=cyan;options=bold>{$module->getName()}</> Module, old status: $status", function() use ($module) { |
|
| 37 | 37 | $module->disable(); |
| 38 | 38 | }); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getInfo(): string|null |
|
| 41 | + public function getInfo(): string | null |
|
| 42 | 42 | { |
| 43 | 43 | return 'Disabling module ...'; |
| 44 | 44 | } |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $module = $this->getModuleModel($name); |
| 24 | 24 | |
| 25 | - $this->components->task("Using <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 25 | + $this->components->task("Using <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 26 | 26 | $this->laravel['modules']->setUsed($module); |
| 27 | 27 | }); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function getInfo(): string|null |
|
| 30 | + public function getInfo(): string | null |
|
| 31 | 31 | { |
| 32 | 32 | return 'Using Module ...'; |
| 33 | 33 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | parent::__construct(); |
| 29 | 29 | |
| 30 | - $this->langPath = DIRECTORY_SEPARATOR . config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
| 30 | + $this->langPath = DIRECTORY_SEPARATOR.config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function executeAction($name): void |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $directories = $this->getDirectories($module); |
| 38 | 38 | |
| 39 | - if (! $directories) { |
|
| 39 | + if (!$directories) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function getInfo(): string|null |
|
| 49 | + public function getInfo(): string | null |
|
| 50 | 50 | { |
| 51 | 51 | return 'Checking languages ...'; |
| 52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | private function getLangFiles($module) |
| 55 | 55 | { |
| 56 | 56 | $files = []; |
| 57 | - $path = $module->getPath() . $this->langPath; |
|
| 57 | + $path = $module->getPath().$this->langPath; |
|
| 58 | 58 | if (is_dir($path)) { |
| 59 | 59 | $files = array_merge($files, $this->laravel['files']->all($path)); |
| 60 | 60 | } |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | private function getDirectories($module) |
| 66 | 66 | { |
| 67 | 67 | $moduleName = $module->getStudlyName(); |
| 68 | - $path = $module->getPath() . $this->langPath; |
|
| 68 | + $path = $module->getPath().$this->langPath; |
|
| 69 | 69 | $directories = []; |
| 70 | 70 | if (is_dir($path)) { |
| 71 | 71 | $directories = $this->laravel['files']->directories($path); |
| 72 | - $directories = array_map(function ($directory) use ($moduleName) { |
|
| 72 | + $directories = array_map(function($directory) use ($moduleName) { |
|
| 73 | 73 | return [ |
| 74 | 74 | 'name' => basename($directory), |
| 75 | 75 | 'module' => $moduleName, |
| 76 | 76 | 'path' => $directory, |
| 77 | - 'files' => array_map(function ($file) { |
|
| 77 | + 'files' => array_map(function($file) { |
|
| 78 | 78 | return basename($file); |
| 79 | - }, \File::glob($directory . DIRECTORY_SEPARATOR . "*")), |
|
| 79 | + }, \File::glob($directory.DIRECTORY_SEPARATOR."*")), |
|
| 80 | 80 | ]; |
| 81 | 81 | }, $directories); |
| 82 | 82 | } |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values(); |
| 105 | 105 | |
| 106 | - $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
| 106 | + $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
| 107 | 107 | |
| 108 | 108 | $missingFiles = $uniqeLangFiles->diff($directory['files']); |
| 109 | 109 | |
| 110 | 110 | if ($missingFiles->count() > 0) { |
| 111 | - $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) { |
|
| 111 | + $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) { |
|
| 112 | 112 | $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}"; |
| 113 | 113 | }); |
| 114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (count($missingFilesMessage) > 0) { |
| 119 | 119 | |
| 120 | - collect($missingFilesMessage)->each(function ($messages, $langDirectory) { |
|
| 120 | + collect($missingFilesMessage)->each(function($messages, $langDirectory) { |
|
| 121 | 121 | |
| 122 | 122 | $this->components->error("Missing language files in $langDirectory directory"); |
| 123 | 123 | |
@@ -140,22 +140,22 @@ discard block |
||
| 140 | 140 | $langDirectories = $directories->pluck('name'); |
| 141 | 141 | |
| 142 | 142 | $missingKeysMessage = []; |
| 143 | - $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
| 143 | + $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
| 144 | 144 | |
| 145 | - $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
| 146 | - $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file); |
|
| 145 | + $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
| 146 | + $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file); |
|
| 147 | 147 | |
| 148 | 148 | if ($langKeys == false) { |
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
| 152 | + $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
| 153 | 153 | |
| 154 | 154 | if ($directory['name'] != $langDirectory) { |
| 155 | 155 | |
| 156 | 156 | $basePath = str_replace($directory['name'], $langDirectory, $directory['path']); |
| 157 | 157 | |
| 158 | - $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file); |
|
| 158 | + $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file); |
|
| 159 | 159 | |
| 160 | 160 | if ($otherLangKeys == false) { |
| 161 | 161 | return; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $missingKeys = $langKeys->diff($otherLangKeys); |
| 165 | 165 | if ($missingKeys->count() > 0) { |
| 166 | 166 | |
| 167 | - $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
| 167 | + $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
| 168 | 168 | $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey"; |
| 169 | 169 | }); |
| 170 | 170 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if (count($missingKeysMessage) > 0) { |
| 178 | 178 | |
| 179 | - collect($missingKeysMessage)->each(function ($messages, $langDirectory) { |
|
| 179 | + collect($missingKeysMessage)->each(function($messages, $langDirectory) { |
|
| 180 | 180 | |
| 181 | 181 | $this->components->error("Missing language keys for directory $langDirectory:"); |
| 182 | 182 | |
@@ -24,12 +24,12 @@ |
||
| 24 | 24 | { |
| 25 | 25 | $module = $this->getModuleModel($name); |
| 26 | 26 | |
| 27 | - $this->components->task("Forget Using <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 27 | + $this->components->task("Forget Using <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 28 | 28 | $this->laravel['modules']->forgetUsed($module); |
| 29 | 29 | }); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getInfo(): string|null |
|
| 32 | + public function getInfo(): string | null |
|
| 33 | 33 | { |
| 34 | 34 | return 'Forget Using Module ...'; |
| 35 | 35 | } |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | ? '<fg=red;options=bold>Disabled</>' |
| 27 | 27 | : '<fg=green;options=bold>Enabled</>'; |
| 28 | 28 | |
| 29 | - $this->components->task("Enabling <fg=cyan;options=bold>{$module->getName()}</> Module, old status: $status", function () use ($module) { |
|
| 29 | + $this->components->task("Enabling <fg=cyan;options=bold>{$module->getName()}</> Module, old status: $status", function() use ($module) { |
|
| 30 | 30 | $module->enable(); |
| 31 | 31 | }); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getInfo(): string|null |
|
| 34 | + public function getInfo(): string | null |
|
| 35 | 35 | { |
| 36 | 36 | return 'Disabling module ...'; |
| 37 | 37 | } |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected function models(): Collection |
| 75 | 75 | { |
| 76 | - if (! empty($models = $this->option('model'))) { |
|
| 77 | - return collect($models)->filter(function ($model) { |
|
| 76 | + if (!empty($models = $this->option('model'))) { |
|
| 77 | + return collect($models)->filter(function($model) { |
|
| 78 | 78 | return class_exists($model); |
| 79 | 79 | })->values(); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $except = $this->option('except'); |
| 83 | 83 | |
| 84 | - if (! empty($models) && ! empty($except)) { |
|
| 84 | + if (!empty($models) && !empty($except)) { |
|
| 85 | 85 | throw new InvalidArgumentException('The --models and --except options cannot be combined.'); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -101,23 +101,23 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return collect(Finder::create()->in($path)->files()->name('*.php')) |
| 104 | - ->map(function ($model) { |
|
| 104 | + ->map(function($model) { |
|
| 105 | 105 | |
| 106 | 106 | $namespace = config('modules.namespace'); |
| 107 | 107 | |
| 108 | - return $namespace . str_replace( |
|
| 108 | + return $namespace.str_replace( |
|
| 109 | 109 | ['/', '.php'], |
| 110 | 110 | ['\\', ''], |
| 111 | 111 | Str::after($model->getRealPath(), realpath(config('modules.paths.modules'))) |
| 112 | 112 | ); |
| 113 | 113 | })->values() |
| 114 | - ->when(! empty($except), function ($models) use ($except) { |
|
| 115 | - return $models->reject(function ($model) use ($except) { |
|
| 114 | + ->when(!empty($except), function($models) use ($except) { |
|
| 115 | + return $models->reject(function($model) use ($except) { |
|
| 116 | 116 | return in_array($model, $except); |
| 117 | 117 | }); |
| 118 | - })->filter(function ($model) { |
|
| 118 | + })->filter(function($model) { |
|
| 119 | 119 | return class_exists($model); |
| 120 | - })->filter(function ($model) { |
|
| 120 | + })->filter(function($model) { |
|
| 121 | 121 | return $this->isPrunable($model); |
| 122 | 122 | })->values(); |
| 123 | 123 | } |