RollbackCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 10 2
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
}