Rollback   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 22
ccs 0
cts 16
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 9 2
1
<?php
2
3
namespace Releaser;
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 Rollback extends Command
11
{
12
    const DISTRIBUTION_PREFIX = 'https://limit-zero.github.io/releaser/';
13
14
    protected function configure()
15
    {
16
        $this
17
            ->setName('rollback')
18
            ->setDescription('Rolls back releaser.phar to the last version')
19
        ;
20
    }
21
22
    protected function execute(InputInterface $input, OutputInterface $output)
23
    {
24
        $updater = new Updater();
25
        $result = $updater->rollback();
26
        if (!$result) {
27
            throw new \Exception('Unable to rollback');
28
        }
29
        $output->writeln(sprintf('Successfully rolled back to %s', $updater->getNewVersion()));
30
    }
31
}
32