@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | parent::__construct(); |
31 | 31 | |
32 | - $this->langPath = DIRECTORY_SEPARATOR . config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
32 | + $this->langPath = DIRECTORY_SEPARATOR.config('modules.paths.generator.lang.path', 'Resources/lang'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function executeAction($name): void |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $directories = $this->getDirectories($module); |
40 | 40 | |
41 | - if (! $directories) { |
|
41 | + if (!$directories) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | - public function getInfo(): string|null |
|
51 | + public function getInfo(): string | null |
|
52 | 52 | { |
53 | 53 | return 'Checking languages ...'; |
54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | private function getLangFiles($module): array |
57 | 57 | { |
58 | 58 | $files = []; |
59 | - $path = $module->getPath() . $this->langPath; |
|
59 | + $path = $module->getPath().$this->langPath; |
|
60 | 60 | if (is_dir($path)) { |
61 | 61 | $files = array_merge($files, $this->laravel['files']->all($path)); |
62 | 62 | } |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | return $files; |
65 | 65 | } |
66 | 66 | |
67 | - private function getDirectories($module): false|Collection |
|
67 | + private function getDirectories($module): false | Collection |
|
68 | 68 | { |
69 | 69 | $moduleName = $module->getStudlyName(); |
70 | - $path = $module->getPath() . $this->langPath; |
|
70 | + $path = $module->getPath().$this->langPath; |
|
71 | 71 | $directories = []; |
72 | 72 | if (is_dir($path)) { |
73 | 73 | $directories = $this->laravel['files']->directories($path); |
74 | - $directories = array_map(function ($directory) use ($moduleName) { |
|
74 | + $directories = array_map(function($directory) use ($moduleName) { |
|
75 | 75 | return [ |
76 | 76 | 'name' => basename($directory), |
77 | 77 | 'module' => $moduleName, |
78 | 78 | 'path' => $directory, |
79 | - 'files' => array_map(function ($file) { |
|
79 | + 'files' => array_map(function($file) { |
|
80 | 80 | return basename($file); |
81 | - }, \File::glob($directory . DIRECTORY_SEPARATOR . "*")), |
|
81 | + }, \File::glob($directory.DIRECTORY_SEPARATOR."*")), |
|
82 | 82 | ]; |
83 | 83 | }, $directories); |
84 | 84 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | |
106 | 106 | $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values(); |
107 | 107 | |
108 | - $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
108 | + $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) { |
|
109 | 109 | |
110 | 110 | $missingFiles = $uniqeLangFiles->diff($directory['files']); |
111 | 111 | |
112 | 112 | if ($missingFiles->count() > 0) { |
113 | - $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) { |
|
113 | + $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) { |
|
114 | 114 | $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}"; |
115 | 115 | }); |
116 | 116 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | if (count($missingFilesMessage) > 0) { |
121 | 121 | |
122 | - collect($missingFilesMessage)->each(function ($messages, $langDirectory) { |
|
122 | + collect($missingFilesMessage)->each(function($messages, $langDirectory) { |
|
123 | 123 | |
124 | 124 | $this->components->error("Missing language files in $langDirectory directory"); |
125 | 125 | |
@@ -142,22 +142,22 @@ discard block |
||
142 | 142 | $langDirectories = $directories->pluck('name'); |
143 | 143 | |
144 | 144 | $missingKeysMessage = []; |
145 | - $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
145 | + $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) { |
|
146 | 146 | |
147 | - $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
148 | - $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file); |
|
147 | + $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) { |
|
148 | + $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file); |
|
149 | 149 | |
150 | 150 | if ($langKeys == false) { |
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | - $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
154 | + $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) { |
|
155 | 155 | |
156 | 156 | if ($directory['name'] != $langDirectory) { |
157 | 157 | |
158 | 158 | $basePath = str_replace($directory['name'], $langDirectory, $directory['path']); |
159 | 159 | |
160 | - $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file); |
|
160 | + $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file); |
|
161 | 161 | |
162 | 162 | if ($otherLangKeys === false) { |
163 | 163 | return; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $missingKeys = $langKeys->diff($otherLangKeys); |
167 | 167 | if ($missingKeys->count() > 0) { |
168 | 168 | |
169 | - $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
169 | + $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) { |
|
170 | 170 | $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey"; |
171 | 171 | }); |
172 | 172 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | if (count($missingKeysMessage) > 0) { |
180 | 180 | |
181 | - collect($missingKeysMessage)->each(function ($messages, $langDirectory) { |
|
181 | + collect($missingKeysMessage)->each(function($messages, $langDirectory) { |
|
182 | 182 | |
183 | 183 | $this->components->error("Missing language keys for directory $langDirectory:"); |
184 | 184 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | - private function getLangKeys($file): false|Collection |
|
194 | + private function getLangKeys($file): false | Collection |
|
195 | 195 | { |
196 | 196 | if (File::exists($file)) { |
197 | 197 | $lang = File::getRequire($file); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $module = $this->getModuleModel($name); |
40 | 40 | |
41 | - $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) { |
|
41 | + $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) { |
|
42 | 42 | try { |
43 | 43 | $this->moduleSeed($module); |
44 | 44 | } catch (\Error $e) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | }); |
57 | 57 | } |
58 | 58 | |
59 | - public function getInfo(): string|null |
|
59 | + public function getInfo(): string | null |
|
60 | 60 | { |
61 | 61 | return 'Seeding module ...'; |
62 | 62 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $config = $module->get('migration'); |
105 | 105 | |
106 | 106 | if (is_array($config) && array_key_exists('seeds', $config)) { |
107 | - foreach ((array)$config['seeds'] as $class) { |
|
107 | + foreach ((array) $config['seeds'] as $class) { |
|
108 | 108 | if (class_exists($class)) { |
109 | 109 | $seeders[] = $class; |
110 | 110 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function dbSeed(string $className): void |
142 | 142 | { |
143 | 143 | if ($option = $this->option('class')) { |
144 | - $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\') . $option; |
|
144 | + $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\').$option; |
|
145 | 145 | } else { |
146 | 146 | $params = ['--class' => $className]; |
147 | 147 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $config = GenerateConfigReader::read('seeder'); |
173 | 173 | $seederPath = str_replace('/', '\\', $config->getPath()); |
174 | 174 | |
175 | - return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
175 | + return $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $foundModules = []; |
193 | 193 | foreach ($this->laravel['modules']->config('scan.paths') as $path) { |
194 | 194 | $namespace = array_slice(explode('/', $path), -1)[0]; |
195 | - $foundModules[] = $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
|
195 | + $foundModules[] = $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $foundModules; |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | use Illuminate\Foundation\Vite; |
5 | 5 | use Illuminate\Support\Facades\Vite as ViteFacade; |
6 | 6 | |
7 | -if (! function_exists('module_path')) { |
|
7 | +if (!function_exists('module_path')) { |
|
8 | 8 | function module_path($name, $path = ''): string |
9 | 9 | { |
10 | 10 | $module = app('modules')->find($name); |
11 | 11 | |
12 | - return $module->getPath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
12 | + return $module->getPath().($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
16 | -if (! function_exists('config_path')) { |
|
16 | +if (!function_exists('config_path')) { |
|
17 | 17 | /** |
18 | 18 | * Get the configuration path. |
19 | 19 | * |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function config_path(string $path = ''): string |
24 | 24 | { |
25 | - return app()->basePath() . '/config' . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
25 | + return app()->basePath().'/config'.($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if (! function_exists('public_path')) { |
|
29 | +if (!function_exists('public_path')) { |
|
30 | 30 | /** |
31 | 31 | * Get the path to the public folder. |
32 | 32 | * |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function public_path(string $path = ''): string |
38 | 38 | { |
39 | - return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
39 | + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -if (! function_exists('module_vite')) { |
|
43 | +if (!function_exists('module_vite')) { |
|
44 | 44 | /** |
45 | 45 | * support for vite |
46 | 46 | */ |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function toArray(): array |
28 | 28 | { |
29 | - return array_map(function ($value) { |
|
29 | + return array_map(function($value) { |
|
30 | 30 | if ($value instanceof Module) { |
31 | 31 | $attributes = $value->json()->getAttributes(); |
32 | 32 | $attributes["path"] = $value->getPath(); |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function decodeContents(): array |
127 | 127 | { |
128 | - $attributes = json_decode($this->getContents(), 1); |
|
128 | + $attributes = json_decode($this->getContents(), 1); |
|
129 | 129 | |
130 | 130 | // any JSON parsing errors should throw an exception |
131 | 131 | if (json_last_error() > 0) { |
132 | - throw new InvalidJsonException('Error processing file: ' . $this->getPath() . '. Error: ' . json_last_error_msg()); |
|
132 | + throw new InvalidJsonException('Error processing file: '.$this->getPath().'. Error: '.json_last_error_msg()); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $attributes; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | return $this->decodeContents(); |
148 | 148 | } |
149 | 149 | |
150 | - return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function () { |
|
150 | + return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function() { |
|
151 | 151 | return $this->decodeContents(); |
152 | 152 | }); |
153 | 153 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function setupStubPath(): void |
35 | 35 | { |
36 | - Stub::setBasePath(__DIR__ . '/Commands/stubs'); |
|
36 | + Stub::setBasePath(__DIR__.'/Commands/stubs'); |
|
37 | 37 | |
38 | 38 | if (app('modules')->config('stubs.enabled') === true) { |
39 | 39 | Stub::setBasePath(app('modules')->config('stubs.path')); |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function registerServices(): void |
47 | 47 | { |
48 | - $this->app->singleton(RepositoryInterface::class, function ($app) { |
|
48 | + $this->app->singleton(RepositoryInterface::class, function($app) { |
|
49 | 49 | $path = $app['config']->get('modules.paths.modules'); |
50 | 50 | |
51 | 51 | return new LumenFileRepository($app, $path); |
52 | 52 | }); |
53 | 53 | |
54 | - $this->app->singleton(ActivatorInterface::class, function ($app) { |
|
54 | + $this->app->singleton(ActivatorInterface::class, function($app) { |
|
55 | 55 | $activator = $app['config']->get('modules.activator'); |
56 | - $class = $app['config']->get('modules.activators.' . $activator)['class']; |
|
56 | + $class = $app['config']->get('modules.activators.'.$activator)['class']; |
|
57 | 57 | |
58 | 58 | return new $class($app); |
59 | 59 | }); |