Completed
Pull Request — master (#1744)
by
unknown
05:18
created
src/Commands/CheckLangCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         parent::__construct();
28 28
 
29
-        $this->langPath = DIRECTORY_SEPARATOR . config('modules.paths.generator.lang.path', 'Resources/lang');
29
+        $this->langPath = DIRECTORY_SEPARATOR.config('modules.paths.generator.lang.path', 'Resources/lang');
30 30
     }
31 31
 
32 32
     public function executeAction($name): void
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
         $directories = $this->getDirectories($module);
37 37
 
38
-        if (! $directories) {
38
+        if (!$directories) {
39 39
             return;
40 40
         }
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     }
47 47
 
48
-    public function getInfo(): string|null
48
+    public function getInfo(): string | null
49 49
     {
50 50
         return 'Checking languages ...';
51 51
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     private function getLangFiles($module)
54 54
     {
55 55
         $files = [];
56
-        $path  = $module->getPath() . $this->langPath;
56
+        $path  = $module->getPath().$this->langPath;
57 57
         if (is_dir($path)) {
58 58
             $files = array_merge($files, $this->laravel['files']->all($path));
59 59
         }
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
     private function getDirectories($module)
65 65
     {
66 66
         $moduleName = $module->getStudlyName();
67
-        $path       = $module->getPath() . '/Resources/lang';
67
+        $path       = $module->getPath().'/Resources/lang';
68 68
         if (is_dir($path)) {
69 69
             $directories = $this->laravel['files']->directories($path);
70
-            $directories = array_map(function ($directory) use ($moduleName) {
70
+            $directories = array_map(function($directory) use ($moduleName) {
71 71
                 return [
72 72
                     'name'   => basename($directory),
73 73
                     'module' => $moduleName,
74 74
                     'path'   => $directory,
75
-                    'files'  => array_map(function ($file) {
75
+                    'files'  => array_map(function($file) {
76 76
                         return basename($file);
77
-                    }, \File::glob($directory . DIRECTORY_SEPARATOR . "*")),
77
+                    }, \File::glob($directory.DIRECTORY_SEPARATOR."*")),
78 78
                 ];
79 79
             }, $directories);
80 80
         }
@@ -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
 
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
         $langDirectories = $directories->pluck('name');
139 139
 
140 140
         $missingKeysMessage = [];
141
-        $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
141
+        $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
142 142
 
143
-            $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) {
144
-                $langKeys = $this->getLangKeys($directory['path'] . DIRECTORY_SEPARATOR . $file);
143
+            $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) {
144
+                $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file);
145 145
 
146 146
                 if ($langKeys == false) {
147 147
                     return;
148 148
                 }
149 149
 
150
-                $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
150
+                $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
151 151
 
152 152
                     if ($directory['name'] != $langDirectory) {
153 153
 
154 154
                         $basePath = str_replace($directory['name'], $langDirectory, $directory['path']);
155 155
 
156
-                        $otherLangKeys = $this->getLangKeys($basePath . DIRECTORY_SEPARATOR . $file);
156
+                        $otherLangKeys = $this->getLangKeys($basePath.DIRECTORY_SEPARATOR.$file);
157 157
 
158 158
                         if ($otherLangKeys == false) {
159 159
                             return;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                         $missingKeys = $langKeys->diff($otherLangKeys);
163 163
                         if ($missingKeys->count() > 0) {
164 164
 
165
-                            $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
165
+                            $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
166 166
                                 $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey";
167 167
                             });
168 168
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
         if (count($missingKeysMessage) > 0) {
176 176
 
177
-            collect($missingKeysMessage)->each(function ($messages, $langDirectory) {
177
+            collect($missingKeysMessage)->each(function($messages, $langDirectory) {
178 178
 
179 179
                 $this->components->error("Missing language keys for directory $langDirectory:");
180 180
 
Please login to merge, or discard this patch.
src/Commands/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
-    public function getInfo(): string|null
32
+    public 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/ModelPruneCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/PublishConfigurationCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         ]);
31 31
     }
32 32
 
33
-    public function getInfo(): string|null
33
+    public function getInfo(): string | null
34 34
     {
35 35
         return 'Publishing module config files ...';
36 36
     }
Please login to merge, or discard this patch.
src/Commands/UseCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/SeedCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $module = $this->getModuleModel($name);
36 36
 
37
-        $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
37
+        $this->components->task("Seeding <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) {
38 38
             try {
39 39
                 $this->moduleSeed($module);
40 40
             } catch (\Error $e) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         });
53 53
     }
54 54
 
55
-    public function getInfo(): string|null
55
+    public function getInfo(): string | null
56 56
     {
57 57
         return 'Seeding module ...';
58 58
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $name = $module->getName();
100 100
         $config = $module->get('migration');
101 101
         if (is_array($config) && array_key_exists('seeds', $config)) {
102
-            foreach ((array)$config['seeds'] as $class) {
102
+            foreach ((array) $config['seeds'] as $class) {
103 103
                 if (class_exists($class)) {
104 104
                     $seeders[] = $class;
105 105
                 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     protected function dbSeed($className)
134 134
     {
135 135
         if ($option = $this->option('class')) {
136
-            $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\') . $option;
136
+            $params['--class'] = Str::finish(substr($className, 0, strrpos($className, '\\')), '\\').$option;
137 137
         } else {
138 138
             $params = ['--class' => $className];
139 139
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $config = GenerateConfigReader::read('seeder');
165 165
         $seederPath = str_replace('/', '\\', $config->getPath());
166 166
 
167
-        return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder';
167
+        return $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder';
168 168
     }
169 169
 
170 170
     /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $foundModules = [];
185 185
         foreach ($this->laravel['modules']->config('scan.paths') as $path) {
186 186
             $namespace = array_slice(explode('/', $path), -1)[0];
187
-            $foundModules[] = $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder';
187
+            $foundModules[] = $namespace.'\\'.$name.'\\'.$seederPath.'\\'.$name.'DatabaseSeeder';
188 188
         }
189 189
 
190 190
         return $foundModules;
Please login to merge, or discard this patch.
src/Commands/EnableCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/MigrateRollbackCommand.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Commands/UnUseCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.