Completed
Pull Request — master (#1766)
by Solomon
06:34
created
src/Commands/Actions/CheckLangCommand.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
46 46
 
47 47
     }
48 48
 
49
-    function getInfo(): string|null
49
+    function getInfo(): string | null
50 50
     {
51 51
         return 'Checking languages ...';
52 52
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
         $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values();
103 103
 
104
-        $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
104
+        $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
105 105
 
106 106
             $missingFiles = $uniqeLangFiles->diff($directory['files']);
107 107
 
108 108
             if ($missingFiles->count() > 0) {
109
-                $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) {
109
+                $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) {
110 110
                     $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}";
111 111
                 });
112 112
             }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         if (count($missingFilesMessage) > 0) {
117 117
 
118
-            collect($missingFilesMessage)->each(function ($messages, $langDirectory) {
118
+            collect($missingFilesMessage)->each(function($messages, $langDirectory) {
119 119
 
120 120
                 $this->components->error("Missing language files in $langDirectory directory");
121 121
 
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
 
140 140
 
141 141
         $missingKeysMessage = [];
142
-        $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
142
+        $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
143 143
 
144
-            $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) {
145
-                $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file);
144
+            $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) {
145
+                $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file);
146 146
 
147 147
                 if ($langKeys == FALSE) {
148 148
                     return;
149 149
                 }
150 150
 
151
-                $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
151
+                $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
152 152
 
153 153
                     if ($directory['name'] != $langDirectory) {
154 154
 
155 155
                         $basePath = str_replace($directory['name'], $langDirectory, $directory['path']);
156 156
 
157
-                        $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file);
157
+                        $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file);
158 158
 
159 159
                         if ($otherLangKeys == FALSE) {
160 160
                             return;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                         $missingKeys = $langKeys->diff($otherLangKeys);
164 164
                         if ($missingKeys->count() > 0) {
165 165
 
166
-                            $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
166
+                            $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
167 167
                                 $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey";
168 168
                             });
169 169
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,8 +193,7 @@
 block discarded – undo
193 193
         if (\File::exists($file)) {
194 194
             $lang = \File::getRequire($file);
195 195
             return collect(\Arr::dot($lang))->keys();
196
-        }
197
-        else {
196
+        } else {
198 197
             return FALSE;
199 198
         }
200 199
     }
Please login to merge, or discard this patch.
src/Commands/Actions/DisableCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
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
-    function getInfo(): string|null
41
+    function getInfo(): string | null
42 42
     {
43 43
         return 'Disabling module ...';
44 44
     }
Please login to merge, or discard this patch.
src/Commands/Actions/ListCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     public function handle(): int
29 29
     {
30 30
         $this->components->twoColumnDetail('<fg=gray>Status / Name</>', '<fg=gray>Path / priority</>');
31
-        collect($this->getRows())->each(function ($row) {
31
+        collect($this->getRows())->each(function($row) {
32 32
 
33 33
             $this->components->twoColumnDetail("[{$row[1]}] {$row[0]}", "{$row[3]} [{$row[2]}]");
34 34
         });
Please login to merge, or discard this patch.
src/Commands/Actions/DumpCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@
 block discarded – undo
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
-    function getInfo(): string|null
32
+    function getInfo(): string | null
33 33
     {
34 34
         return 'Generating optimized autoload modules';
35 35
     }
Please login to merge, or discard this patch.
src/Commands/Database/MigrateCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
     {
27 27
         $module = $this->getModuleModel($name);
28 28
 
29
-        $this->components->task("Running Migration <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
29
+        $this->components->task("Running Migration <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) {
30 30
             $path = str_replace(base_path(), '', (new Migrator($module, $this->getLaravel()))->getPath());
31 31
 
32 32
             if ($this->option('subpath')) {
33
-                $path = $path . "/" . $this->option("subpath");
33
+                $path = $path."/".$this->option("subpath");
34 34
             }
35 35
 
36 36
             $this->call('migrate', [
Please login to merge, or discard this patch.
src/Commands/Database/SeedCommand.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
             }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         });
56 56
     }
57 57
 
58
-    function getInfo(): string|null
58
+    function getInfo(): string | null
59 59
     {
60 60
         return 'Seeding module ...';
61 61
     }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $name = $module->getName();
103 103
         $config = $module->get('migration');
104 104
         if (is_array($config) && array_key_exists('seeds', $config)) {
105
-            foreach ((array)$config['seeds'] as $class) {
105
+            foreach ((array) $config['seeds'] as $class) {
106 106
                 if (class_exists($class)) {
107 107
                     $seeders[] = $class;
108 108
                 }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     protected function dbSeed($className)
137 137
     {
138 138
         if ($option = $this->option('class')) {
139
-            $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\') . $option;
139
+            $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\').$option;
140 140
         } else {
141 141
             $params = ['--class' => $className];
142 142
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $config = GenerateConfigReader::read('seeder');
168 168
         $seederPath = str_replace('/', '\\', $config->getPath());
169 169
 
170
-        return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder';
170
+        return $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder';
171 171
     }
172 172
 
173 173
     /**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $foundModules = [];
188 188
         foreach ($this->laravel['modules']->config('scan.paths') as $path) {
189 189
             $namespace = array_slice(explode('/', $path), -1)[0];
190
-            $foundModules[] = $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder';
190
+            $foundModules[] = $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder';
191 191
         }
192 192
 
193 193
         return $foundModules;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,15 +38,13 @@
 block discarded – undo
38 38
         $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
39 39
             try {
40 40
                 $this->moduleSeed($module);
41
-            }
42
-            catch (\Error $e) {
41
+            } catch (\Error $e) {
43 42
                 $e = new ErrorException($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
44 43
                 $this->reportException($e);
45 44
                 $this->renderException($this->getOutput(), $e);
46 45
 
47 46
                 return FALSE;
48
-            }
49
-            catch (\Exception $e) {
47
+            } catch (\Exception $e) {
50 48
                 $this->reportException($e);
51 49
                 $this->renderException($this->getOutput(), $e);
52 50
 
Please login to merge, or discard this patch.
src/Commands/Database/MigrateRefreshCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         $module = $this->getModuleModel($name);
27 27
 
28
-        $this->components->task("Refreshing Migration {$module->getName()} module", function () use ($module) {
28
+        $this->components->task("Refreshing Migration {$module->getName()} module", function() use ($module) {
29 29
             $this->call('module:migrate-reset', [
30 30
                 'module'     => $module->getStudlyName(),
31 31
                 '--database' => $this->option('database'),
Please login to merge, or discard this patch.
src/Commands/Database/MigrateStatusCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/Database/MigrateResetCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.