InstallCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 50
ccs 0
cts 33
cp 0
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
B execute() 0 29 1
A configure() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of Packy.
5
 *
6
 * (c) Peter Nijssen
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AppBundle\Command;
13
14
use Symfony\Component\Console\Command\Command;
15
use Symfony\Component\Console\Input\ArrayInput;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
class InstallCommand extends Command
20
{
21
    /**
22
     * Configure the command.
23
     */
24
    protected function configure()
25
    {
26
        $this
27
            ->setName('packy:install')
28
            ->setDescription('Install packy');
29
    }
30
31
    /**
32
     * Execute the command.
33
     *
34
     * @param InputInterface  $input
35
     * @param OutputInterface $output
36
     *
37
     * @throws \Exception
38
     */
39
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41
        $command = $this->getApplication()->find('doctrine:database:create');
42
        $arguments = [
43
            'command' => 'doctrine:database:create',
44
            '--if-not-exists' => true,
45
            '--quiet' => true,
46
        ];
47
        $input = new ArrayInput($arguments);
48
        $input->setInteractive(false);
49
        $command->run($input, $output);
50
51
        $command = $this->getApplication()->find('doctrine:migrations:migrate');
52
        $arguments = [
53
            'command' => 'doctrine:migrations:migrate',
54
            '--quiet' => true,
55
        ];
56
        $input = new ArrayInput($arguments);
57
        $input->setInteractive(false);
58
        $command->run($input, $output);
59
60
        $userCommand = $this->getApplication()->find('fos:user:create');
61
        $arguments = [
62
            'command' => 'fos:user:create',
63
            '--super-admin' => true,
64
        ];
65
        $input = new ArrayInput($arguments);
66
        $userCommand->run($input, $output);
67
    }
68
}
69