SyncMetadataCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations\Tools\Console\Command;
6
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
final class SyncMetadataCommand extends DoctrineCommand
11
{
12
    /** @var string */
13
    protected static $defaultName = 'migrations:sync-metadata-storage';
14
15 1
    protected function configure() : void
16
    {
17 1
        parent::configure();
18
19
        $this
20 1
            ->setAliases(['sync-metadata-storage'])
21 1
            ->setDescription('Ensures that the metadata storage is at the latest version.')
22 1
            ->setHelp(<<<EOT
23 1
The <info>%command.name%</info> command updates metadata storage the latest version.
24
25
    <info>%command.full_name%</info>
26
EOT
27
            );
28 1
    }
29
30 1
    public function execute(
31
        InputInterface $input,
32
        OutputInterface $output
33
    ) : int {
34 1
        $this->getDependencyFactory()->getMetadataStorage()->ensureInitialized();
35
36 1
        $this->io->success('Metadata storage synchronized');
37
38 1
        return 0;
39
    }
40
}
41