DropDatabaseCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\MongoDbBundle\Command;
6
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Class DropDatabaseCommand.
12
 */
13
class DropDatabaseCommand extends AbstractCommand
14
{
15
    /**
16 8
     * {@inheritdoc}
17
     */
18 8
    protected function configure()
19
    {
20 8
        parent::configure();
21 8
        $this
22 8
            ->setName('mongodb:database:drop')
23
            ->setDescription('Drops a database');
24
    }
25
26
    /**
27 1
     * {@inheritdoc}
28
     */
29 1
    protected function execute(InputInterface $input, OutputInterface $output)
30 1
    {
31 1
        $this->io->writeln(sprintf('Dropping database %s', $this->connection->getDatabaseName()));
32 1
        $this->connection->drop();
33
        $this->io->writeln('Database dropped');
34
35
        return 0;
36
    }
37
}
38