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

CreateCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 8 1
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