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

CreateCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 10
cp 0
crap 2
rs 9.9666
c 1
b 0
f 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