Completed
Pull Request — master (#1513)
by
unknown
08:25
created
src/helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 use Illuminate\Foundation\Vite;
4 4
 use Illuminate\Support\Facades\Vite as ViteFacade;
5 5
 
6
-if (! function_exists('module_path')) {
6
+if (!function_exists('module_path')) {
7 7
     function module_path($name, $path = '')
8 8
     {
9 9
         $module = app('modules')->find($name);
10 10
 
11
-        return $module->getPath() . ($path ? DIRECTORY_SEPARATOR . $path : $path);
11
+        return $module->getPath().($path ? DIRECTORY_SEPARATOR . $path : $path);
12 12
     }
13 13
 }
14 14
 
15
-if (! function_exists('config_path')) {
15
+if (!function_exists('config_path')) {
16 16
     /**
17 17
      * Get the configuration path.
18 18
      *
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
      */
22 22
     function config_path($path = '')
23 23
     {
24
-        return app()->basePath() . '/config' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
24
+        return app()->basePath().'/config'.($path ? DIRECTORY_SEPARATOR . $path : $path);
25 25
     }
26 26
 }
27 27
 
28
-if (! function_exists('public_path')) {
28
+if (!function_exists('public_path')) {
29 29
     /**
30 30
      * Get the path to the public folder.
31 31
      *
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
      */
35 35
     function public_path($path = '')
36 36
     {
37
-        return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path);
37
+        return app()->make('path.public').($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path);
38 38
     }
39 39
 }
40 40
 
41
-if (! function_exists('module_vite')) {
41
+if (!function_exists('module_vite')) {
42 42
     /**
43 43
      * support for vite
44 44
      */
Please login to merge, or discard this patch.
src/Generators/ModuleGenerator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 continue;
360 360
             }
361 361
 
362
-            $path = $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . $folder->getPath();
362
+            $path = $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.$folder->getPath();
363 363
 
364 364
             $this->filesystem->makeDirectory($path, 0755, true);
365 365
             if (config('modules.stubs.gitkeep')) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function generateGitKeep($path)
377 377
     {
378
-        $this->filesystem->put($path . DIRECTORY_SEPARATOR . '.gitkeep', '');
378
+        $this->filesystem->put($path.DIRECTORY_SEPARATOR.'.gitkeep', '');
379 379
     }
380 380
 
381 381
     /**
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
     public function generateFiles()
385 385
     {
386 386
         foreach ($this->getFiles() as $stub => $file) {
387
-            $path = $this->module->getModulePath($this->getName()) . $file;
387
+            $path = $this->module->getModulePath($this->getName()).$file;
388 388
 
389
-            $this->component->task("Generating file {$path}",function () use ($stub, $path) {
389
+            $this->component->task("Generating file {$path}", function() use ($stub, $path) {
390 390
                 if (!$this->filesystem->isDirectory($dir = dirname($path))) {
391 391
                     $this->filesystem->makeDirectory($dir, 0775, true);
392 392
                 }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 
412 412
         if (GenerateConfigReader::read('provider')->generate() === true) {
413 413
             $this->console->call('module:make-provider', [
414
-                'name' => $this->getName() . 'ServiceProvider',
414
+                'name' => $this->getName().'ServiceProvider',
415 415
                 'module' => $this->getName(),
416 416
                 '--master' => true,
417 417
             ]);
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
         }
422 422
 
423 423
         if (GenerateConfigReader::read('controller')->generate() === true) {
424
-            $options = $this->type=='api' ? ['--api'=>true] : [];
424
+            $options = $this->type == 'api' ? ['--api'=>true] : [];
425 425
             $this->console->call('module:make-controller', [
426
-                'controller' => $this->getName() . 'Controller',
426
+                'controller' => $this->getName().'Controller',
427 427
                 'module' => $this->getName(),
428
-            ]+$options);
428
+            ] + $options);
429 429
         }
430 430
     }
431 431
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     protected function getStubContents($stub)
440 440
     {
441 441
         return (new Stub(
442
-            DIRECTORY_SEPARATOR . $stub . '.stub',
442
+            DIRECTORY_SEPARATOR.$stub.'.stub',
443 443
             $this->getReplacement($stub)
444 444
         )
445 445
         )->render();
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             }
479 479
         }
480 480
         foreach ($keys as $key) {
481
-            if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) {
481
+            if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) {
482 482
                 $replaces[$key] = $this->$method();
483 483
             } else {
484 484
                 $replaces[$key] = null;
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
      */
494 494
     private function generateModuleJsonFile()
495 495
     {
496
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
496
+        $path = $this->module->getModulePath($this->getName()).'module.json';
497 497
 
498
-        $this->component->task("Generating file $path",function () use ($path) {
498
+        $this->component->task("Generating file $path", function() use ($path) {
499 499
             if (!$this->filesystem->isDirectory($dir = dirname($path))) {
500 500
                 $this->filesystem->makeDirectory($dir, 0775, true);
501 501
             }
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
      */
511 511
     private function cleanModuleJsonFile()
512 512
     {
513
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
513
+        $path = $this->module->getModulePath($this->getName()).'module.json';
514 514
 
515 515
         $content = $this->filesystem->get($path);
516 516
         $namespace = $this->getModuleNamespaceReplacement();
517 517
         $studlyName = $this->getStudlyNameReplacement();
518 518
 
519
-        $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"';
519
+        $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"';
520 520
 
521 521
         $content = str_replace($provider, '', $content);
522 522
 
Please login to merge, or discard this patch.
src/Module.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $lowerName = $this->getLowerName();
185 185
 
186
-        $langPath = $this->getPath() . '/Resources/lang';
186
+        $langPath = $this->getPath().'/Resources/lang';
187 187
 
188 188
         if (is_dir($langPath)) {
189 189
             $this->loadTranslationsFrom($langPath, $lowerName);
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
             $file = 'module.json';
204 204
         }
205 205
 
206
-        return Arr::get($this->moduleJson, $file, function () use ($file) {
207
-            return $this->moduleJson[$file] = new Json($this->getPath() . DIRECTORY_SEPARATOR . $file, $this->files);
206
+        return Arr::get($this->moduleJson, $file, function() use ($file) {
207
+            return $this->moduleJson[$file] = new Json($this->getPath().DIRECTORY_SEPARATOR.$file, $this->files);
208 208
         });
209 209
     }
210 210
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     protected function fireEvent($event): void
259 259
     {
260
-        $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]);
260
+        $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
261 261
     }
262 262
     /**
263 263
      * Register the aliases from this module.
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     protected function registerFiles(): void
283 283
     {
284 284
         foreach ($this->get('files', []) as $file) {
285
-            include $this->path . DIRECTORY_SEPARATOR . $file;
285
+            include $this->path.DIRECTORY_SEPARATOR.$file;
286 286
         }
287 287
     }
288 288
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      */
388 388
     public function getExtraPath(string $path): string
389 389
     {
390
-        return $this->getPath() . DIRECTORY_SEPARATOR . $path;
390
+        return $this->getPath().DIRECTORY_SEPARATOR.$path;
391 391
     }
392 392
 
393 393
     /**
Please login to merge, or discard this patch.
src/Laravel/LaravelDatabaseRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         $module = $this->find($name);
89 89
 
90 90
         if ($module) {
91
-            return $module->getPath() . DIRECTORY_SEPARATOR;
91
+            return $module->getPath().DIRECTORY_SEPARATOR;
92 92
         }
93 93
 
94
-        return $this->getPath() . DIRECTORY_SEPARATOR . Str::studly($name) . DIRECTORY_SEPARATOR;
94
+        return $this->getPath().DIRECTORY_SEPARATOR.Str::studly($name).DIRECTORY_SEPARATOR;
95 95
     }
96 96
 
97 97
     /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function getCached()
150 150
     {
151
-        return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () {
151
+        return $this->cache->store($this->config->get('modules.cache.driver'))->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() {
152 152
             return $this->getModel()->all()->keyBy('name')->toArray();
153 153
         });
154 154
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         // Support modules that already there or copy/paste and not scan yet.
229 229
         // So we scan all module.json in every folder.
230 230
         foreach ($paths as $path) {
231
-            $manifests = $this->getFiles()->glob($path . DIRECTORY_SEPARATOR . 'module.json');
231
+            $manifests = $this->getFiles()->glob($path.DIRECTORY_SEPARATOR.'module.json');
232 232
 
233 233
             is_array($manifests) || $manifests = [];
234 234
 
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 
270 270
     public function update($name)
271 271
     {
272
-        $module =  $this->findOrFail($name);
272
+        $module = $this->findOrFail($name);
273 273
         $updater = new Updater($this);
274 274
         if ($this->config('database_management.update_file_to_database_when_updating')) {
275
-            $json = Json::make($module->getPath() . DIRECTORY_SEPARATOR . 'module.json');
275
+            $json = Json::make($module->getPath().DIRECTORY_SEPARATOR.'module.json');
276 276
             $data = $json->getAttributes();
277 277
 
278 278
             if (!isset($data['version'])) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             $allows = $this->getModel()->getFillable();
305 305
         }
306 306
 
307
-        return array_filter($attributes, function ($k) use ($allows) {
307
+        return array_filter($attributes, function($k) use ($allows) {
308 308
             return in_array($k, $allows);
309 309
         }, ARRAY_FILTER_USE_KEY);
310 310
     }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $modules = $this->allEnabled();
315 315
 
316
-        uasort($modules, function (DatabaseModule $a, DatabaseModule $b) use ($direction) {
316
+        uasort($modules, function(DatabaseModule $a, DatabaseModule $b) use ($direction) {
317 317
             if ($a->get('priority') === $b->get('priority')) {
318 318
                 return 0;
319 319
             }
Please login to merge, or discard this patch.
src/Json.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function decodeContents()
122 122
     {
123
-        $attributes =  json_decode($this->getContents(), 1);
123
+        $attributes = json_decode($this->getContents(), 1);
124 124
 
125 125
         // any JSON parsing errors should throw an exception
126 126
         if (json_last_error() > 0) {
127
-            throw new InvalidJsonException('Error processing file: ' . $this->getPath() . '. Error: ' . json_last_error_msg());
127
+            throw new InvalidJsonException('Error processing file: '.$this->getPath().'. Error: '.json_last_error_msg());
128 128
         }
129 129
 
130 130
         return $attributes;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             return $this->decodeContents();
143 143
         }
144 144
 
145
-        return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function () {
145
+        return app('cache')->store(config('modules.cache.driver'))->remember($this->getPath(), config('modules.cache.lifetime'), function() {
146 146
             return $this->decodeContents();
147 147
         });
148 148
     }
Please login to merge, or discard this patch.
src/Providers/BootstrapServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
             $this->registerMigrations();
23 23
 
24 24
             $this->publishes([
25
-                __DIR__ . '/../../database/migrations' => database_path('migrations'),
25
+                __DIR__.'/../../database/migrations' => database_path('migrations'),
26 26
             ], 'module-migrations');
27 27
         }
28 28
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     private function registerMigrations()
39 39
     {
40
-        $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
40
+        $this->loadMigrationsFrom(__DIR__.'/../../database/migrations');
41 41
     }
42 42
 
43 43
     /**
Please login to merge, or discard this patch.