Completed
Push — dev ( b3febe...ca104c )
by Zach
02:14
created

DBGenerate::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
42
            $output->writeln($message);
43
        }
44
    }
45
}
46