@@ -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 | } |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $module = $this->getModuleModel($name); |
| 24 | 24 | |
| 25 | - $this->components->task("Generating for <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 25 | + $this->components->task("Generating for <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 26 | 26 | chdir($module->getPath()); |
| 27 | 27 | |
| 28 | 28 | passthru('composer dump -o -n -q'); |
| 29 | 29 | }); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getInfo(): string|null |
|
| 32 | + public function getInfo(): string | null |
|
| 33 | 33 | { |
| 34 | 34 | return 'Generating optimized autoload modules'; |
| 35 | 35 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $database = $this->option('database'); |
| 34 | 34 | |
| 35 | - if (! empty($database)) { |
|
| 35 | + if (!empty($database)) { |
|
| 36 | 36 | $migrator->setDatabase($database); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | if (count($migrated)) { |
| 42 | 42 | foreach ($migrated as $migration) { |
| 43 | - $this->components->task("Rollback: <info>{$migration}</info>", ); |
|
| 43 | + $this->components->task("Rollback: <info>{$migration}</info>",); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function getInfo(): string|null |
|
| 53 | + public function getInfo(): string | null |
|
| 54 | 54 | { |
| 55 | 55 | return null; |
| 56 | 56 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | ]); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getInfo(): string|null |
|
| 41 | + public function getInfo(): string | null |
|
| 42 | 42 | { |
| 43 | 43 | return null; |
| 44 | 44 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $module = $this->getModuleModel($name); |
| 37 | 37 | |
| 38 | - $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
| 38 | + $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
| 39 | 39 | try { |
| 40 | 40 | $this->moduleSeed($module); |
| 41 | 41 | } catch (\Error $e) { |
@@ -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 'Seeding module ...'; |
| 59 | 59 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $config = $module->get('migration'); |
| 102 | 102 | |
| 103 | 103 | if (is_array($config) && array_key_exists('seeds', $config)) { |
| 104 | - foreach ((array)$config['seeds'] as $class) { |
|
| 104 | + foreach ((array) $config['seeds'] as $class) { |
|
| 105 | 105 | if (class_exists($class)) { |
| 106 | 106 | $seeders[] = $class; |
| 107 | 107 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | protected function dbSeed($className) |
| 139 | 139 | { |
| 140 | 140 | if ($option = $this->option('class')) { |
| 141 | - $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\') . $option; |
|
| 141 | + $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\').$option; |
|
| 142 | 142 | } else { |
| 143 | 143 | $params = ['--class' => $className]; |
| 144 | 144 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $config = GenerateConfigReader::read('seeder'); |
| 170 | 170 | $seederPath = str_replace('/', '\\', $config->getPath()); |
| 171 | 171 | |
| 172 | - return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
| 172 | + return $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $foundModules = []; |
| 190 | 190 | foreach ($this->laravel['modules']->config('scan.paths') as $path) { |
| 191 | 191 | $namespace = array_slice(explode('/', $path), -1)[0]; |
| 192 | - $foundModules[] = $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
| 192 | + $foundModules[] = $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $foundModules; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $database = $this->option('database'); |
| 34 | 34 | |
| 35 | - if (! empty($database)) { |
|
| 35 | + if (!empty($database)) { |
|
| 36 | 36 | $migrator->setDatabase($database); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->components->warn("Nothing to rollback on module <fg=cyan;options=bold>{$module->getName()}</>"); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getInfo(): string|null |
|
| 52 | + public function getInfo(): string | null |
|
| 53 | 53 | { |
| 54 | 54 | return null; |
| 55 | 55 | } |