ModuleMakeCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 15
c 1
b 0
f 0
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 15 2
1
<?php
2
3
namespace Rawilk\LaravelModules\Commands\Generators;
4
5
use Illuminate\Console\Command;
6
use Rawilk\LaravelModules\Contracts\Activator;
7
use Rawilk\LaravelModules\Generators\ModuleGenerator;
8
9
class ModuleMakeCommand extends Command
10
{
11
    /** @var string */
12
    protected $signature = 'module:make
13
                            {name* : The name(s) of modules to create}
14
                            {--p|plain : Generate a plain module (without some resources)}
15
                            {--force : Force the module to be generated if the module already exists}
16
                            {--d|disabled : Do not enable the module at creation}';
17
18
    /** @var string */
19
    protected $description = 'Create a new module.';
20
21
    public function handle(): void
22
    {
23
        $names = $this->argument('name');
24
25
        foreach ($names as $name) {
26
            with(new ModuleGenerator($name))
27
                ->setFilesystem($this->laravel['files'])
28
                ->setModule($this->laravel['modules'])
29
                ->setConfig($this->laravel['config'])
30
                ->setActivator($this->laravel[Activator::class])
31
                ->setConsole($this)
32
                ->setForce($this->option('force'))
0 ignored issues
show
Bug introduced by
$this->option('force') of type string is incompatible with the type boolean expected by parameter $force of Rawilk\LaravelModules\Ge...leGenerator::setForce(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
                ->setForce(/** @scrutinizer ignore-type */ $this->option('force'))
Loading history...
33
                ->setPlain($this->option('plain'))
0 ignored issues
show
Bug introduced by
$this->option('plain') of type string is incompatible with the type boolean expected by parameter $plain of Rawilk\LaravelModules\Ge...leGenerator::setPlain(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
                ->setPlain(/** @scrutinizer ignore-type */ $this->option('plain'))
Loading history...
34
                ->setActive(! $this->option('disabled'))
35
                ->generate();
36
        }
37
    }
38
}
39