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

Fifree2dropdatabaseCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 8
cts 10
cp 0.8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 2
crap 2.032
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