Rollback::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 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