Passed
Pull Request — master (#176)
by Maxim
17:36 queued 14:52
created

CreateCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command\Migration;
6
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Yiisoft\Yii\Console\ExitCode;
11
12
final class CreateCommand extends BaseMigrationCommand
13
{
14
    protected static $defaultName = 'migrate/create';
15
    protected static $defaultDescription = 'Creates an empty migration';
16
17 1
    public function configure(): void
18
    {
19 1
        $this->setHelp('This command allows you to create a custom migration')
20 1
             ->addArgument('name', InputArgument::REQUIRED, 'Migration name');
21
    }
22
23 1
    protected function execute(InputInterface $input, OutputInterface $output): int
24
    {
25
        /** @var string $customName */
26 1
        $customName = $input->getArgument('name');
27
28 1
        $this->createEmptyMigration($output, $customName);
29
30 1
        return ExitCode::OK;
31
    }
32
}
33