Completed
Branch 5.0 (8ad39c)
by Andrea
04:14
created

Fifree2dropdatabaseCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2.0438

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.0438
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 3
    protected function configure()
15
    {
16
        $this
17 3
                ->setName('fifree2:dropdatabase')
18 3
                ->setDescription('Cancellazione database fifree')
19 3
                ->setHelp('Cancella il database e tutti i dati di fifree')
20 3
                ->addOption('force', null, InputOption::VALUE_NONE, 'Se non impostato, il comando non avrà effetto');
21 3
    }
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');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
34 1
        $arguments = array('command' => 'doctrine:schema:drop', '--force' => true);
35 1
        $inputcmd = new ArrayInput($arguments);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
36 1
        $command->run($inputcmd, $output);
37 1
    }
38
}
39