Passed
Push — master ( 28f242...472b4c )
by Gabriel
04:44
created

CreateCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
dl 0
loc 27
ccs 0
cts 14
cp 0
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 1
A execute() 0 4 1
1
<?php
2
3
namespace ByTIC\Migrations\Console;
4
5
use ByTIC\Console\Command;
6
use Exception;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Class CreateCommand
13
 * @package ByTIC\Migrations\Console
14
 */
15
class CreateCommand extends Command
16
{
17
    protected function configure()
18
    {
19
        parent::configure();
20
        $this->setName('migrations:create');
21
22
        $this->setDescription('Create a new migration')
23
            ->addArgument('name', InputArgument::OPTIONAL, 'Class name of the migration (in CamelCase)')
24
            ->setHelp(
25
                sprintf(
26
                    '%sCreates a new database migration%s',
27
                    PHP_EOL,
28
                    PHP_EOL
29
                )
30
            );
31
    }
32
33
    /**
34
     * @inheritDoc
35
     * @noinspection PhpMissingParentCallCommonInspection
36
     * @throws Exception
37
     */
38
    protected function execute(InputInterface $input, OutputInterface $output)
39
    {
40
        $migrator = migrator();
41
        return $migrator->create($input->getArguments(), $output);
42
    }
43
}
44