GenerateCommand::getInputCommand()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
/**
3
 * Reddogs (https://github.com/reddogs-at)
4
 *
5
 * @see https://github.com/reddogs-at/reddogs-doctrine-migrations for the canonical source repository
6
 * @license https://github.com/reddogs-at/reddogs-doctrine-migrations/blob/master/LICENSE MIT License
7
 */
8
namespace Reddogs\Doctrine\Migrations;
9
10
use ZF\Console\Route;
11
12
/**
13
 * Command for generating new blank module migration classes
14
 */
15
class GenerateCommand extends AbstractCommand
16
{
17
    /**
18
     * Boolean rout params
19
     *
20
     * @var array
21
     */
22
    protected $booleanParams = [
23
        '--quiet',
24
        '-q',
25
        '-n',
26
        '--verbose',
27
        '-v',
28
        '-vv',
29
        '-vvv'
30
    ];
31
32
    /**
33
     * Get input command
34
     * {@inheritDoc}
35
     * @see \Reddogs\Doctrine\Migrations\AbstractCommand::getInputCommand()
36
     */
37
    public function getInputCommand(Route $route)
38
    {
39
        $matches = $route->getMatches();
40
        $inputCommand =  'migrations:generate';
41
42
        if (is_array($matches)) {
43
            $params = [];
44
            $params = $this->applyBooleanParams($params, $matches);
45
            if (! empty($params)) {
46
                $inputCommand .= ' ' . implode(' ', $params);
47
            }
48
        }
49
        return $inputCommand;
50
    }
51
}