ListCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command\Migration;
6
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Yiisoft\Yii\Console\ExitCode;
10
11
final class ListCommand extends BaseMigrationCommand
12
{
13
    protected static $defaultName = 'migrate/list';
14
    protected static $defaultDescription = 'Prints list of all migrations';
15
16 1
    protected function execute(InputInterface $input, OutputInterface $output): int
17
    {
18 1
        $list = $this->findMigrations($output);
19
20 1
        foreach ($list as $migration) {
21 1
            $state = $migration->getState();
22 1
            $output->writeln('<fg=cyan>' . $state->getName() . '</> '
23 1
                . '<fg=yellow>[' . (self::MIGRATION_STATUS[$state->getStatus()] ?? '?') . ']</>');
24
        }
25 1
        return ExitCode::OK;
26
    }
27
}
28