Completed
Pull Request — master (#2042)
by Solomon
05:44
created
src/Commands/UpdatePhpunitCoverage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@
 block discarded – undo
31 31
         $phpunitXmlPath = base_path('phpunit.xml');
32 32
         $modulesStatusPath = base_path('modules_statuses.json');
33 33
 
34
-        if (! file_exists($phpunitXmlPath)) {
34
+        if (!file_exists($phpunitXmlPath)) {
35 35
             $this->error("phpunit.xml file not found: {$phpunitXmlPath}");
36 36
 
37 37
             return 100;
38 38
         }
39 39
 
40
-        if (! file_exists($modulesStatusPath)) {
40
+        if (!file_exists($modulesStatusPath)) {
41 41
             $this->error("Modules statuses file not found: {$modulesStatusPath}");
42 42
 
43 43
             return 99;
Please login to merge, or discard this patch.
src/Commands/Actions/ModelPruneCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             return;
51 51
         }
52 52
 
53
-        if (! empty($input->getArgument('module'))) {
53
+        if (!empty($input->getArgument('module'))) {
54 54
             return;
55 55
         }
56 56
 
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function models(): Collection
79 79
     {
80
-        if (! empty($models = $this->option('model'))) {
81
-            return collect($models)->filter(function ($model) {
80
+        if (!empty($models = $this->option('model'))) {
81
+            return collect($models)->filter(function($model) {
82 82
                 return class_exists($model);
83 83
             })->values();
84 84
         }
85 85
 
86 86
         $except = $this->option('except');
87 87
 
88
-        if (! empty($models) && ! empty($except)) {
88
+        if (!empty($models) && !empty($except)) {
89 89
             throw new InvalidArgumentException('The --models and --except options cannot be combined.');
90 90
         }
91 91
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         return collect(Finder::create()->in($path)->files()->name('*.php'))
112
-            ->map(function ($model) {
112
+            ->map(function($model) {
113 113
 
114 114
                 $namespace = config('modules.namespace');
115 115
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
                 );
121 121
             })
122 122
             ->values()
123
-            ->when(! empty($except), function ($models) use ($except) {
124
-                return $models->reject(function ($model) use ($except) {
123
+            ->when(!empty($except), function($models) use ($except) {
124
+                return $models->reject(function($model) use ($except) {
125 125
                     return in_array($model, $except);
126 126
                 });
127
-            })->filter(function ($model) {
127
+            })->filter(function($model) {
128 128
                 return class_exists($model);
129
-            })->filter(function ($model) {
129
+            })->filter(function($model) {
130 130
                 return $this->isPrunable($model);
131 131
             })->values();
132 132
     }
Please login to merge, or discard this patch.
src/ModuleManifest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getProviders(): array
56 56
     {
57
-        if (! empty($this->manifest)) {
57
+        if (!empty($this->manifest)) {
58 58
             return $this->manifest;
59 59
         }
60 60
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         // todo check this section store on module.php or not?
79 79
         $this->getModulesData()
80
-            ->each(function (array $manifest) {
80
+            ->each(function(array $manifest) {
81 81
                 if (empty($manifest['files'])) {
82 82
                     return;
83 83
                 }
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function getModulesData(): Collection
92 92
     {
93
-        if (! empty(self::$manifestData) && ! app()->runningUnitTests()) {
93
+        if (!empty(self::$manifestData) && !app()->runningUnitTests()) {
94 94
             return self::$manifestData;
95 95
         }
96 96
 
97 97
         self::$manifestData = $this->paths
98
-            ->flatMap(function ($path) {
98
+            ->flatMap(function($path) {
99 99
                 $manifests = $this->files->glob("{$path}/module.json");
100 100
                 is_array($manifests) || $manifests = [];
101 101
 
102 102
                 return collect($manifests)
103
-                    ->map(function ($manifest) {
103
+                    ->map(function($manifest) {
104 104
                         return [
105 105
                             'module_directory' => dirname($manifest),
106 106
                             ...$this->files->json($manifest),
Please login to merge, or discard this patch.
src/Commands/Actions/CheckLangCommand.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -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
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
         $directories = [];
69 69
         if (is_dir($path)) {
70 70
             $directories = $this->laravel['files']->directories($path);
71
-            $directories = array_map(function ($directory) use ($moduleName) {
71
+            $directories = array_map(function($directory) use ($moduleName) {
72 72
                 return [
73 73
                     'name' => basename($directory),
74 74
                     'module' => $moduleName,
75 75
                     'path' => $directory,
76
-                    'files' => array_map(function ($file) {
76
+                    'files' => array_map(function($file) {
77 77
                         return basename($file);
78 78
                     }, \File::glob($directory.DIRECTORY_SEPARATOR.'*')),
79 79
                 ];
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 
103 103
         $uniqeLangFiles = $directories->pluck('files')->flatten()->unique()->values();
104 104
 
105
-        $directories->each(function ($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
105
+        $directories->each(function($directory) use ($uniqeLangFiles, &$missingFilesMessage) {
106 106
 
107 107
             $missingFiles = $uniqeLangFiles->diff($directory['files']);
108 108
 
109 109
             if ($missingFiles->count() > 0) {
110
-                $missingFiles->each(function ($missingFile) use ($directory, &$missingFilesMessage) {
110
+                $missingFiles->each(function($missingFile) use ($directory, &$missingFilesMessage) {
111 111
                     $missingFilesMessage[$directory['name']][] = " {$directory['module']} - Missing language file: {$directory['name']}/{$missingFile}";
112 112
                 });
113 113
             }
@@ -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
 
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
         $langDirectories = $directories->pluck('name');
136 136
 
137 137
         $missingKeysMessage = [];
138
-        $directories->each(function ($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
138
+        $directories->each(function($directory) use ($uniqeLangFiles, $langDirectories, &$missingKeysMessage) {
139 139
 
140
-            $uniqeLangFiles->each(function ($file) use ($directory, $langDirectories, &$missingKeysMessage) {
140
+            $uniqeLangFiles->each(function($file) use ($directory, $langDirectories, &$missingKeysMessage) {
141 141
                 $langKeys = $this->getLangKeys($directory['path'].DIRECTORY_SEPARATOR.$file);
142 142
 
143 143
                 if ($langKeys == false) {
144 144
                     return;
145 145
                 }
146 146
 
147
-                $langDirectories->each(function ($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
147
+                $langDirectories->each(function($langDirectory) use ($directory, $file, $langKeys, &$missingKeysMessage) {
148 148
 
149 149
                     if ($directory['name'] != $langDirectory) {
150 150
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                         $missingKeys = $langKeys->diff($otherLangKeys);
160 160
                         if ($missingKeys->count() > 0) {
161 161
 
162
-                            $missingKeys->each(function ($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
162
+                            $missingKeys->each(function($missingKey) use ($directory, $langDirectory, $file, &$missingKeysMessage) {
163 163
                                 $missingKeysMessage[$langDirectory][] = " {$directory['module']} - Missing language key: {$langDirectory}/{$file} | key: $missingKey";
164 164
                             });
165 165
                         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         if (count($missingKeysMessage) > 0) {
172 172
 
173
-            collect($missingKeysMessage)->each(function ($messages, $langDirectory) {
173
+            collect($missingKeysMessage)->each(function($messages, $langDirectory) {
174 174
 
175 175
                 $this->components->error("Missing language keys for directory $langDirectory:");
176 176
 
Please login to merge, or discard this patch.
src/Commands/Actions/DumpCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     {
25 25
         $module = $this->getModuleModel($name);
26 26
 
27
-        $this->components->task("Generating for <fg=cyan;options=bold>{$module->getName()}</> Module", function () use ($module) {
27
+        $this->components->task("Generating for <fg=cyan;options=bold>{$module->getName()}</> Module", function() use ($module) {
28 28
             chdir($module->path());
29 29
 
30 30
             passthru('composer dump -o -n -q');
Please login to merge, or discard this patch.
src/Commands/ComposerUpdateCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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 29
             $composer_path = $module->path('composer.json');
30 30
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Traits/PathNamespace.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             $replace = $ds === '/' ? '\\' : '/';
16 16
         }
17 17
 
18
-        return Str::of($path)->rtrim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment, $key) => $key == 0 or ! empty($segment))->implode($ds);
18
+        return Str::of($path)->rtrim($ds)->replace($replace, $ds)->explode($ds)->filter(fn ($segment, $key) => $key == 0 or !empty($segment))->implode($ds);
19 19
     }
20 20
 
21 21
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function module_namespace(string $module, ?string $path = null): string
89 89
     {
90 90
         $module_namespace = rtrim(config('modules.namespace') ?? config('modules.paths.modules'), '\\').'\\'.($module);
91
-        if (! empty($path)) {
91
+        if (!empty($path)) {
92 92
             $module_namespace .= '\\'.trim($path, '\\');
93 93
         }
94 94
 
Please login to merge, or discard this patch.
src/Migrations/Migrator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getMigrations($reverse = false)
115 115
     {
116
-        if (! empty($this->subpath)) {
116
+        if (!empty($this->subpath)) {
117 117
             $files = $this->laravel['files']->glob($this->path($this->subpath));
118 118
         } else {
119 119
             $files = $this->laravel['files']->glob($this->path().'/*_*.php');
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             return [];
127 127
         }
128 128
 
129
-        $files = array_map(function ($file) {
129
+        $files = array_map(function($file) {
130 130
             return str_replace('.php', '', basename($file));
131 131
         }, $files);
132 132
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         $class = Str::studly($name);
232 232
 
233
-        if (! class_exists($class) && file_exists($this->path($file.'.php'))) {
233
+        if (!class_exists($class) && file_exists($this->path($file.'.php'))) {
234 234
             return include $this->path($file.'.php');
235 235
         }
236 236
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
         $result = $query->orderBy('migration', 'desc')->get();
326 326
 
327
-        return collect($result)->map(function ($item) {
327
+        return collect($result)->map(function($item) {
328 328
             return (array) $item;
329 329
         })->pluck('migration');
330 330
     }
Please login to merge, or discard this patch.
src/Collection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function toArray(): array
22 22
     {
23
-        return array_map(function ($value) {
23
+        return array_map(function($value) {
24 24
             if ($value instanceof Module) {
25 25
                 $attributes = $value->json()->getAttributes();
26 26
                 $attributes['path'] = $value->path();
Please login to merge, or discard this patch.