Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 3 | protected function execute(InputInterface $input, OutputInterface $output) : int |
|
30 | { |
||
31 | 3 | $aliasResolver = $this->getDependencyFactory()->getVersionAliasResolver(); |
|
32 | |||
33 | 3 | $version = $aliasResolver->resolveVersionAlias('current'); |
|
34 | 3 | if ((string) $version === '0') { |
|
35 | 1 | $description = '(No migration executed yet)'; |
|
36 | } else { |
||
37 | try { |
||
38 | 2 | $availableMigration = $this->getDependencyFactory()->getMigrationRepository()->getMigration($version); |
|
39 | 1 | $description = $availableMigration->getMigration()->getDescription(); |
|
40 | 1 | } catch (MigrationClassNotFound $e) { |
|
41 | 1 | $description = '(Migration info not available)'; |
|
42 | } |
||
43 | } |
||
44 | |||
45 | 3 | $output->writeln(sprintf( |
|
46 | 3 | '<info>%s</info>%s', |
|
47 | 3 | (string) $version, |
|
48 | 3 | $description !== '' ? ' - ' . $description : '' |
|
49 | )); |
||
50 | |||
51 | 3 | return 0; |
|
52 | } |
||
54 |