SelfUpdateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 18
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

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