Completed
Push — master ( b3febe...348067 )
by Zach
04:06 queued 02:03
created

DBGenerate::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 12
rs 9.4285
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\Config\Config;
6
use Yarak\DB\DirectoryCreator;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class DBGenerate extends YarakCommand
11
{
12
    /**
13
     * Configure the command.
14
     */
15
    protected function configure()
16
    {
17
        $this->setName('db:generate')
18
            ->setDescription('Generate the database directory structure.')
19
            ->setHelp(
20
                'This command will create all the database directories and files necessary for yarak to run.'
21
            );
22
    }
23
24
    /**
25
     * Execute the command.
26
     *
27
     * @param InputInterface  $input
28
     * @param OutputInterface $output
29
     */
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $config = Config::getInstance($this->configArray);
33
34
        $creator = new DirectoryCreator($config);
35
36
        $creator->create();
37
38
        foreach ($creator->getLog() as $message) {
39
            $output->writeln($message);
40
        }
41
    }
42
}
43