GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SetupDatabaseCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 12
ccs 0
cts 10
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * This file is part of the Gerrie package.
4
 *
5
 * (c) Andreas Grunwald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Gerrie\Command;
12
13
use Gerrie\Component\Configuration\ConfigurationFactory;
14
use Gerrie\Component\Configuration\CommandConfiguration;
15
use Gerrie\Component\Database\Database;
16
use Gerrie\Service\DatabaseService;
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Output\OutputInterface;
19
20
class SetupDatabaseCommand extends GerrieBaseCommand
21
{
22
23
    /**
24
     * Command name
25
     *
26
     * @var string
27
     */
28
    const COMMAND_NAME = 'Setup Database';
29
30
    /**
31
     * Database object
32
     *
33
     * @var \Gerrie\Service\DatabaseService
34
     */
35
    protected $databaseService = null;
36
37
    protected function configure()
38
    {
39
        $this
40
            ->setName('gerrie:setup-database')
41
            ->setDescription('Setup / Creates the required database scheme (tables only)');
42
43
        $this->addConfigFileOption();
44
        $this->addDatabaseOptions();
45
    }
46
47
    protected function initialize(InputInterface $input, OutputInterface $output)
48
    {
49
        /** @var InputExtendedInterface $input */
50
51
        $configFile = $input->getOption('config-file');
52
        $configuration = ConfigurationFactory::getConfigurationByConfigFileAndCommandOptionsAndArguments($configFile, $input);
53
54
        $databaseConfig = $configuration->getConfigurationValue('Database');
55
        $database = new Database($databaseConfig);
56
57
        $this->databaseService = new DatabaseService($database, $output);
58
    }
59
60
    protected function execute(InputInterface $input, OutputInterface $output)
61
    {
62
        $output->writeln('');
63
        $output->writeln('<comment>Starting application "' . self::COMMAND_NAME . '"</comment>');
64
        $output->writeln('');
65
66
        $this->databaseService->setupDatabaseTables();
67
68
        $output->writeln('');
69
        $output->writeln('<comment>Application "' . self::COMMAND_NAME . '" finished</comment>');
70
        $output->writeln('');
71
    }
72
}