Completed
Push — master ( 7d0f62...257374 )
by Alexander
22s queued 11s
created

ListCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
1
<?php
2
namespace Yiisoft\Yii\Cycle\Command;
3
4
use Symfony\Component\Console\Input\InputInterface;
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
class ListCommand extends BaseMigrationCommand
8
{
9
    protected static $defaultName = 'migrate/list';
10
11
    public function configure(): void
12
    {
13
        $this
14
            ->setDescription('Print list of all migrations');
15
    }
16
17
    protected function execute(InputInterface $input, OutputInterface $output)
18
    {
19
        $list = $this->findMigrations($output);
20
21
        foreach ($list as $migration) {
22
            $state = $migration->getState();
23
            $output->writeln('<fg=cyan>' . $state->getName() . '</> '
24
                . '<fg=yellow>[' . (static::$migrationStatus[$state->getStatus()] ?? '?') . ']</>');
25
        }
26
    }
27
}
28