Completed
Push — master ( e262bd...cc6d72 )
by Andrea
08:21
created

Fifree2dropdatabaseCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 28
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 15 2
1
<?php
2
3
namespace Fi\CoreBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Input\ArrayInput;
10
11
class Fifree2dropdatabaseCommand extends ContainerAwareCommand
12
{
13
14 2
    protected function configure()
15
    {
16
        $this
17 2
                ->setName('fifree2:dropdatabase')
18 2
                ->setDescription('Cancellazione database fifree')
19 2
                ->setHelp('Cancella il database e tutti i dati di fifree')
20 2
                ->addOption('force', null, InputOption::VALUE_NONE, 'Se non impostato, il comando non avrà effetto');
21 2
    }
22
23 1
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25 1
        $force = $input->getOption('force');
26
27 1
        if (!$force) {
28
            echo "Specificare l'opzione --force per eseguire il comando";
29
30
            return 1;
31
        }
32
33 1
        $command = $this->getApplication()->find('doctrine:schema:drop');
34 1
        $arguments = array('command' => 'doctrine:schema:drop', '--force' => true);
35 1
        $inputcmd = new ArrayInput($arguments);
36 1
        $command->run($inputcmd, $output);
37 1
    }
38
}
39