UninstallCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 2
c 4
b 0
f 1
lcom 0
cbo 5
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 9 1
A execute() 0 9 1
1
<?php
2
3
namespace kujaff\VersionsBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Console\Input\InputArgument;
9
10
/**
11
 * Installation after schema update
12
 */
13
class UninstallCommand extends ContainerAwareCommand
14
{
15
16
    /**
17
     * {@inherited}
18
     */
19
    protected function configure()
20
    {
21
        $this
22
            ->setName('bundle:uninstall')
23
            ->setDescription('Uninstall a bundle, use --force to force uninstall although bundle is not installed')
24
            ->addArgument('name', InputArgument::REQUIRED)
25
            ->addOption('force')
26
        ;
27
    }
28
29
    /**
30
     * {@inherited}
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $name = $input->getArgument('name');
35
        $force = $input->getOption('force');
36
37
        $output->write('[<comment>' . $name . '</comment>] Uninstalling ...');
38
        $this->getContainer()->get('versions.installer')->uninstall($name, $force);
39
        $output->write(' <info>Done</info>', true);
40
    }
41
}
42