Passed
Branch master (8cb5b2)
by Christopher
04:37
created

Migrate::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
ccs 6
cts 7
cp 0.8571
crap 2.0116
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Triadev\Leopard\Console\Commands\Mapping;
3
4
use Illuminate\Console\ConfirmableTrait;
5
use Triadev\Leopard\Business\Mapping\Mapper;
6
7
class Migrate extends BaseCommand
8
{
9
    use ConfirmableTrait;
10
    
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'triadev:mapping:migrate {--index=} {--type=}';
17
    
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Start the mapping migrations.';
24
    
25
    /**
26
     * Execute the console command.
27
     *
28
     * @param Mapper $mapper
29
     * @throws \Throwable
30
     */
31 1
    public function handle(Mapper $mapper)
32
    {
33 1
        if (!$this->confirmToProceed()) {
34
            return;
35
        }
36
        
37 1
        $mapper->run(
38 1
            $this->getMappingPath(),
39 1
            $this->option('index'),
40 1
            $this->option('type')
41
        );
42 1
    }
43
}
44