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

DBGenerate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 3
lcom 2
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 12 2
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