GenerateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 12 1
1
<?php
2
/**
3
 * PHPCI - Continuous Integration for PHP.
4
 *
5
 * @copyright    Copyright 2014, Block 8 Limited.
6
 * @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
7
 *
8
 * @link         https://www.phptesting.org/
9
 */
10
11
namespace PHPCI\Command;
12
13
use Symfony\Component\Console\Command\Command;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
use b8\Database;
17
use b8\Database\CodeGenerator;
18
19
/**
20
 * Generate console command - Reads the database and generates models and stores.
21
 *
22
 * @author       Dan Cryer <[email protected]>
23
 */
24
class GenerateCommand extends Command
25
{
26
    protected function configure()
27
    {
28
        $this
29
            ->setName('phpci:generate')
30
            ->setDescription('Generate models and stores from the database.');
31
    }
32
33
    /**
34
     * Generates Model and Store classes by reading database meta data.
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $gen = new CodeGenerator(
39
            Database::getConnection(),
40
            array('default' => 'PHPCI'),
41
            array('default' => PHPCI_DIR),
0 ignored issues
show
Documentation introduced by
array('default' => PHPCI_DIR) is of type array<string,?>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
42
            false
43
        );
44
45
        $gen->generateModels();
46
        $gen->generateStores();
47
    }
48
}
49