RollbackCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
namespace T3G\Elasticorn\Commands\Self;
4
5
use Humbug\SelfUpdate\Updater;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class RollbackCommand extends Command
11
{
12
    /**
13
     * Configure the rollback command
14
     *
15
     * @return void
16
     */
17
    protected function configure()
18
    {
19
        parent::configure();
20
        $this
21
            ->setName('self:rollback')
22
            ->setDescription('Rollback elasticorn to the previous version.');
23
    }
24
25
    public function execute(InputInterface $input, OutputInterface $output)
26
    {
27
        $updater = new Updater();
28
        $result = $updater->rollback();
29
        if (false === $result) {
30
            $output->writeln('Something went wrong, rollback failed.');
31
        } else {
32
            $output->writeln(sprintf('Successfully performed rollback.'));
33
        }
34
    }
35
}