Completed
Pull Request — master (#1163)
by
unknown
01:59
created
src/Commands/ListenerMakeCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 
78 78
     protected function getEventName(Module $module)
79 79
     {
80
-        $namespace = $this->laravel['modules']->config('namespace') . "\\" . $module->getStudlyName();
80
+        $namespace = $this->laravel['modules']->config('namespace')."\\".$module->getStudlyName();
81 81
         $eventPath = GenerateConfigReader::read('event');
82 82
 
83
-        $eventName = $namespace . "\\" . $eventPath->getPath() . "\\" . $this->option('event');
83
+        $eventName = $namespace."\\".$eventPath->getPath()."\\".$this->option('event');
84 84
 
85 85
         return str_replace('/', '\\', $eventName);
86 86
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $listenerPath = GenerateConfigReader::read('listener');
93 93
 
94
-        return $path . $listenerPath->getPath() . '/' . $this->getFileName() . '.php';
94
+        return $path.$listenerPath->getPath().'/'.$this->getFileName().'.php';
95 95
     }
96 96
 
97 97
     /**
Please login to merge, or discard this patch.
src/Laravel/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
         // This checks if we are running on a Laravel Vapor managed instance
19 19
         // and sets the path to a writable one (services path is not on a writable storage in Vapor).
20 20
         if (!is_null(env('VAPOR_MAINTENANCE_MODE', null))) {
21
-            return Str::replaceLast('config.php', $this->getSnakeName() . '_module.php', $this->app->getCachedConfigPath());
21
+            return Str::replaceLast('config.php', $this->getSnakeName().'_module.php', $this->app->getCachedConfigPath());
22 22
         }
23 23
 
24
-        return Str::replaceLast('services.php', $this->getSnakeName() . '_module.php', $this->app->getCachedServicesPath());
24
+        return Str::replaceLast('services.php', $this->getSnakeName().'_module.php', $this->app->getCachedServicesPath());
25 25
     }
26 26
 
27 27
     /**
Please login to merge, or discard this patch.
src/FileRepository.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             $paths = array_merge($paths, $this->config('scan.paths'));
117 117
         }
118 118
 
119
-        $paths = array_map(function ($path) {
119
+        $paths = array_map(function($path) {
120 120
             return Str::endsWith($path, '/*') ? $path : Str::finish($path, '/*');
121 121
         }, $paths);
122 122
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getCached()
202 202
     {
203
-        return $this->cache->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () {
203
+        return $this->cache->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() {
204 204
             return $this->toCollection()->toArray();
205 205
         });
206 206
     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $modules = $this->allEnabled();
291 291
 
292
-        uasort($modules, function (Module $a, Module $b) use ($direction) {
292
+        uasort($modules, function(Module $a, Module $b) use ($direction) {
293 293
             if ($a->get('priority') === $b->get('priority')) {
294 294
                 return 0;
295 295
             }
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
     public function getModulePath($module)
419 419
     {
420 420
         try {
421
-            return $this->findOrFail($module)->getPath() . '/';
421
+            return $this->findOrFail($module)->getPath().'/';
422 422
         } catch (ModuleNotFoundException $e) {
423
-            return $this->getPath() . '/' . Str::studly($module) . '/';
423
+            return $this->getPath().'/'.Str::studly($module).'/';
424 424
         }
425 425
     }
426 426
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
      */
430 430
     public function assetPath(string $module) : string
431 431
     {
432
-        return $this->config('paths.assets') . '/' . $module;
432
+        return $this->config('paths.assets').'/'.$module;
433 433
     }
434 434
 
435 435
     /**
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
      */
438 438
     public function config(string $key, $default = null)
439 439
     {
440
-        return $this->config->get('modules.' . $key, $default);
440
+        return $this->config->get('modules.'.$key, $default);
441 441
     }
442 442
 
443 443
     /**
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
         }
528 528
         list($name, $url) = explode(':', $asset);
529 529
 
530
-        $baseUrl = str_replace(public_path() . DIRECTORY_SEPARATOR, '', $this->getAssetsPath());
530
+        $baseUrl = str_replace(public_path().DIRECTORY_SEPARATOR, '', $this->getAssetsPath());
531 531
 
532
-        $url = $this->url->asset($baseUrl . "/{$name}/" . $url);
532
+        $url = $this->url->asset($baseUrl."/{$name}/".$url);
533 533
 
534 534
         return str_replace(['http://', 'https://'], '//', $url);
535 535
     }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,9 +126,7 @@  discard block
 block discarded – undo
126 126
     /**
127 127
      * Creates a new Module instance
128 128
      *
129
-     * @param Container $app
130
-     * @param string $args
131
-     * @param string $path
129
+     * @param string[] $args
132 130
      * @return \Nwidart\Modules\Module
133 131
      */
134 132
     abstract protected function createModule(...$args);
@@ -239,7 +237,7 @@  discard block
 block discarded – undo
239 237
     /**
240 238
      * Determine whether the given module exist.
241 239
      *
242
-     * @param $name
240
+     * @param string $name
243 241
      *
244 242
      * @return bool
245 243
      */
@@ -610,7 +608,7 @@  discard block
 block discarded – undo
610 608
     /**
611 609
      * Get stub path.
612 610
      *
613
-     * @return string|null
611
+     * @return string|boolean
614 612
      */
615 613
     public function getStubPath()
616 614
     {
Please login to merge, or discard this patch.
src/Commands/FactoryMakeCommand.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     }
60 60
 
61 61
     /**
62
-     * @return mixed
62
+     * @return string
63 63
      */
64 64
     protected function getTemplateContents()
65 65
     {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     /**
81
-     * @return mixed
81
+     * @return string
82 82
      */
83 83
     protected function getDestinationFilePath()
84 84
     {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     }
91 91
 
92 92
     /**
93
-     * @return mixed|string
93
+     * @return string
94 94
      */
95 95
     private function getModelName()
96 96
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         $factoryPath = GenerateConfigReader::read('factory');
71 71
 
72
-        return $path . $factoryPath->getPath() . '/' . $this->getFileName();
72
+        return $path.$factoryPath->getPath().'/'.$this->getFileName();
73 73
     }
74 74
 
75 75
     /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     private function getFileName()
79 79
     {
80
-        return Str::studly($this->argument('name')) . 'Factory.php';
80
+        return Str::studly($this->argument('name')).'Factory.php';
81 81
     }
82 82
 
83 83
     /**
@@ -107,6 +107,6 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function getModelNamespace(): string
109 109
     {
110
-        return $this->laravel['modules']->config('namespace') . '\\' . $this->laravel['modules']->findOrFail($this->getModuleName()) . '\\' . $this->laravel['modules']->config('paths.generator.model.path', 'Entities');
110
+        return $this->laravel['modules']->config('namespace').'\\'.$this->laravel['modules']->findOrFail($this->getModuleName()).'\\'.$this->laravel['modules']->config('paths.generator.model.path', 'Entities');
111 111
     }
112 112
 }
Please login to merge, or discard this patch.
src/Commands/ComponentClassMakeCommand.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         ];
75 75
     }
76 76
     /**
77
-     * @return mixed
77
+     * @return string
78 78
      */
79 79
     protected function getTemplateContents()
80 80
     {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 
91 91
     /**
92
-     * @return mixed
92
+     * @return string
93 93
      */
94 94
     protected function getDestinationFilePath()
95 95
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected function writeComponentViewTemplate()
51 51
     {
52
-        $this->call('module:make-component-view', ['name' => $this->argument('name') , 'module' => $this->argument('module')]);
52
+        $this->call('module:make-component-view', ['name' => $this->argument('name'), 'module' => $this->argument('module')]);
53 53
     }
54 54
 
55 55
     public function getDefaultNamespace() : string
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'NAMESPACE'         => $this->getClassNamespace($module),
83 83
             'CLASS'             => $this->getClass(),
84 84
             'LOWER_NAME'        => $module->getLowerName(),
85
-            'COMPONENT_NAME'    => 'components.' . Str::lower($this->argument('name')),
85
+            'COMPONENT_NAME'    => 'components.'.Str::lower($this->argument('name')),
86 86
         ]))->render();
87 87
     }
88 88
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $path = $this->laravel['modules']->getModulePath($this->getModuleName());
95 95
         $factoryPath = GenerateConfigReader::read('component-class');
96 96
 
97
-        return $path . $factoryPath->getPath() . '/' . $this->getFileName();
97
+        return $path.$factoryPath->getPath().'/'.$this->getFileName();
98 98
     }
99 99
 
100 100
     /**
@@ -102,6 +102,6 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function getFileName()
104 104
     {
105
-        return Str::studly($this->argument('name')) . '.php';
105
+        return Str::studly($this->argument('name')).'.php';
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
src/Commands/ComponentViewMakeCommand.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     }
60 60
 
61 61
     /**
62
-     * @return mixed
62
+     * @return string
63 63
      */
64 64
     protected function getTemplateContents()
65 65
     {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     /**
76
-     * @return mixed
76
+     * @return string
77 77
      */
78 78
     protected function getDestinationFilePath()
79 79
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $path = $this->laravel['modules']->getModulePath($this->getModuleName());
64 64
         $factoryPath = GenerateConfigReader::read('component-view');
65 65
 
66
-        return $path . $factoryPath->getPath() . '/' . $this->getFileName();
66
+        return $path.$factoryPath->getPath().'/'.$this->getFileName();
67 67
     }
68 68
 
69 69
     /**
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
      */
72 72
     private function getFileName()
73 73
     {
74
-        return Str::lower($this->argument('name')) . '.blade.php';
74
+        return Str::lower($this->argument('name')).'.blade.php';
75 75
     }
76 76
 }
Please login to merge, or discard this patch.
src/Generators/ModuleGenerator.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                 continue;
332 332
             }
333 333
 
334
-            $path = $this->module->getModulePath($this->getName()) . '/' . $folder->getPath();
334
+            $path = $this->module->getModulePath($this->getName()).'/'.$folder->getPath();
335 335
 
336 336
             $this->filesystem->makeDirectory($path, 0755, true);
337 337
             if (config('modules.stubs.gitkeep')) {
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function generateGitKeep($path)
349 349
     {
350
-        $this->filesystem->put($path . '/.gitkeep', '');
350
+        $this->filesystem->put($path.'/.gitkeep', '');
351 351
     }
352 352
 
353 353
     /**
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     public function generateFiles()
357 357
     {
358 358
         foreach ($this->getFiles() as $stub => $file) {
359
-            $path = $this->module->getModulePath($this->getName()) . $file;
359
+            $path = $this->module->getModulePath($this->getName()).$file;
360 360
 
361 361
             if (!$this->filesystem->isDirectory($dir = dirname($path))) {
362 362
                 $this->filesystem->makeDirectory($dir, 0775, true);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
         if (GenerateConfigReader::read('provider')->generate() === true) {
385 385
             $this->console->call('module:make-provider', [
386
-                'name' => $this->getName() . 'ServiceProvider',
386
+                'name' => $this->getName().'ServiceProvider',
387 387
                 'module' => $this->getName(),
388 388
                 '--master' => true,
389 389
             ]);
@@ -393,11 +393,11 @@  discard block
 block discarded – undo
393 393
         }
394 394
 
395 395
         if (GenerateConfigReader::read('controller')->generate() === true) {
396
-            $options = $this->type=='api'?['--api'=>true]:[];
396
+            $options = $this->type == 'api' ? ['--api'=>true] : [];
397 397
             $this->console->call('module:make-controller', [
398
-                'controller' => $this->getName() . 'Controller',
398
+                'controller' => $this->getName().'Controller',
399 399
                 'module' => $this->getName(),
400
-            ]+$options);
400
+            ] + $options);
401 401
         }
402 402
     }
403 403
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     protected function getStubContents($stub)
412 412
     {
413 413
         return (new Stub(
414
-            '/' . $stub . '.stub',
414
+            '/'.$stub.'.stub',
415 415
             $this->getReplacement($stub)
416 416
         )
417 417
         )->render();
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
             }
451 451
         }
452 452
         foreach ($keys as $key) {
453
-            if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) {
453
+            if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) {
454 454
                 $replaces[$key] = $this->$method();
455 455
             } else {
456 456
                 $replaces[$key] = null;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
      */
466 466
     private function generateModuleJsonFile()
467 467
     {
468
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
468
+        $path = $this->module->getModulePath($this->getName()).'module.json';
469 469
 
470 470
         if (!$this->filesystem->isDirectory($dir = dirname($path))) {
471 471
             $this->filesystem->makeDirectory($dir, 0775, true);
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
      */
483 483
     private function cleanModuleJsonFile()
484 484
     {
485
-        $path = $this->module->getModulePath($this->getName()) . 'module.json';
485
+        $path = $this->module->getModulePath($this->getName()).'module.json';
486 486
 
487 487
         $content = $this->filesystem->get($path);
488 488
         $namespace = $this->getModuleNamespaceReplacement();
489 489
         $studlyName = $this->getStudlyNameReplacement();
490 490
 
491
-        $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"';
491
+        $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"';
492 492
 
493 493
         $content = str_replace($provider, '', $content);
494 494
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     /**
238 238
      * Set the module instance.
239 239
      *
240
-     * @param mixed $module
240
+     * @param \Nwidart\Modules\Laravel\LaravelDatabaseRepository $module
241 241
      *
242 242
      * @return $this
243 243
      */
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     /**
272 272
      * Set force status.
273 273
      *
274
-     * @param bool|int $force
274
+     * @param boolean $force
275 275
      *
276 276
      * @return $this
277 277
      */
Please login to merge, or discard this patch.
src/Commands/ModuleMakeCommand.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,10 +76,10 @@
 block discarded – undo
76 76
     }
77 77
 
78 78
     /**
79
-    * Get module type .
80
-    *
81
-    * @return string
82
-    */
79
+     * Get module type .
80
+     *
81
+     * @return string
82
+     */
83 83
     private function getModuleType()
84 84
     {
85 85
         $isPlain = $this->option('plain');
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
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             $this->registerMigrations();
19 19
 
20 20
             $this->publishes([
21
-                __DIR__ . '/../../database/migrations' => database_path('migrations'),
21
+                __DIR__.'/../../database/migrations' => database_path('migrations'),
22 22
             ], 'module-migrations');
23 23
         }
24 24
     }
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
 
34 34
     private function registerMigrations()
35 35
     {
36
-        $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
36
+        $this->loadMigrationsFrom(__DIR__.'/../../database/migrations');
37 37
     }
38 38
 }
Please login to merge, or discard this patch.