SelfUpdateCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Cpliakas\ManifestPublisher\Console;
4
5
use Herrera\Phar\Update\Manager;
6
use Herrera\Phar\Update\Manifest;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class SelfUpdateCommand extends Command
12
{
13
    const MANIFEST_FILE = 'http://cpliakas.github.io/manifest-publisher/manifest.json';
14
15
    protected function configure()
16
    {
17
        $this
18
            ->setName('self-update')
19
            ->setDescription('Updates manifest.phar to the latest version')
20
        ;
21
    }
22
23
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25
        $manager = new Manager(Manifest::loadFile(self::MANIFEST_FILE));
26
        $manager->update($this->getApplication()->getVersion(), true);
27
    }
28
}
29