Completed
Push — master ( 80d94b...95c442 )
by Jonathan
31s
created

CreateDatabases::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace PHPChunkit\Command;
6
7
use PHPChunkit\Events;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Output\OutputInterface;
12
use Symfony\Component\EventDispatcher\EventDispatcher;
13
14
/**
15
 * @testClass PHPChunkit\Test\Command\CreateDatabasesTest
16
 */
17
class CreateDatabases implements CommandInterface
18
{
19
    const NAME = 'create-dbs';
20
21
    /**
22
     * @var EventDispatcher
23
     */
24
    private $eventDispatcher;
25
26 1
    public function __construct(EventDispatcher $eventDispatcher)
27
    {
28 1
        $this->eventDispatcher = $eventDispatcher;
29 1
    }
30
31
    public function getName() : string
32
    {
33
        return self::NAME;
34
    }
35
36
    public function configure(Command $command)
37
    {
38
        $command
39
            ->setDescription('Create the test databases.')
40
            ->addOption('sandbox', null, InputOption::VALUE_NONE, 'Prepare sandbox before creating databases.')
41
        ;
42
    }
43
44 1
    public function execute(InputInterface $input, OutputInterface $output)
45
    {
46 1
        $this->eventDispatcher->dispatch(Events::DATABASES_CREATE);
47
48 1
        if (!$input->getOption('quiet')) {
49 1
            $output->writeln('Done creating databases!');
50
        }
51 1
    }
52
}
53