MakeMigrationCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace LaraGeoData\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
8
class MakeMigrationCommand extends Command
9
{
10
    use HasTablesClassesMap, HasSuffixOption;
11
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'geonames:make:migration
18
        {type : Migration type. }
19
        {--suffix= : Suffix used for specify country if need. }
20
    ';
21
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Publish specific migrations.';
28
29
    /**
30
     * The filesystem instance.
31
     *
32
     * @var Filesystem
33
     */
34
    protected Filesystem $files;
35
36
    /**
37
     * Create a new command instance.
38
     *
39
     * @param Filesystem $files
40
     *
41
     * @return void
42
     */
43 18
    public function __construct(Filesystem $files)
44
    {
45 18
        parent::__construct();
46
47 18
        $this->files = $files;
48 18
    }
49
50 11
    public function handle()
51
    {
52 11
        $this->makeTableObjectNameByType($this->argument('type'), $this->files)
0 ignored issues
show
Bug introduced by
It seems like $this->argument('type') can also be of type array and null; however, parameter $type of LaraGeoData\Console\Comm...TableObjectNameByType() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

52
        $this->makeTableObjectNameByType(/** @scrutinizer ignore-type */ $this->argument('type'), $this->files)
Loading history...
53 11
             ->makeMigration($this->getSuffix());
54
55 11
        return 0;
56
    }
57
}
58