Completed
Push — master ( b31514...603a9f )
by Changwan
06:16
created

DownCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 6 1
1
<?php
2
namespace Wandu\Database\Migrator\Commands;
3
4
use Wandu\Console\Command;
5
use Wandu\Console\Exception\ConsoleException;
6
use RuntimeException;
7
use Wandu\Database\Migrator\Migrator;
8
9
class DownCommand extends Command
10
{
11
    /** @var string */
12
    protected $description = 'Execute targeted rollback.';
13
14
    /** @var array */
15
    protected $arguments = [
16
        'id' => 'the migrate id for the rollback',
17
    ];
18
    
19
    /** @var \Wandu\Database\Migrator\Migrator */
20
    protected $manager;
21
22
    /**
23
     * @param \Wandu\Database\Migrator\Migrator $manager
24
     */
25
    public function __construct(Migrator $manager)
26
    {
27
        $this->manager = $manager;
28
    }
29
30
    public function execute()
31
    {
32
        $id = $this->input->getArgument('id');
33
        $this->manager->down($id);
34
        $this->output->writeln("<info>down</info> {$id}");
35
    }
36
}
37