BaseCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 40
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A configure() 0 9 1
A execute() 0 6 1
1
<?php
2
/**
3
 * This file is part of the Symfony Console DI package.
4
 *
5
 * (c) Stéphane Demonchaux <[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
namespace SymfonyDiConsole;
11
12
use Symfony\Component\Console\Command\Command;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
class BaseCommand extends Command
17
{
18
    /**
19
     * @var string
20
     */
21
    private $diConsoleCommandClass;
22
23
    /**
24
     * @param string $command
25
     */
26 3
    public function __construct($diConsoleCommandClass)
27
    {
28 3
        $this->diConsoleCommandClass = $diConsoleCommandClass;
29
30 3
        parent::__construct();
31 3
    }
32
33
    /* (non-PHPdoc)
34
     * @see \Symfony\Component\Console\Command\Command::configure()
35
     */
36 3
    protected function configure()
37
    {
38 3
        $diConsoleCommandClass = $this->diConsoleCommandClass;
39 3
        $config                = $diConsoleCommandClass::configure();
40
41 3
        $this->setDefinition($config->getDefinition())
42 3
             ->setDescription($config->getDescription())
43 3
             ->setName($config->getName());
44 3
    }
45
46
    /* (non-PHPdoc)
47
     * @see \Symfony\Component\Console\Command\Command::execute()
48
     */
49 3
    public function execute(InputInterface $input, OutputInterface $output)
50
    {
51 3
        $diConsoleCommandClass = $this->diConsoleCommandClass;
52
53 3
        $diConsoleCommandClass::getInstance()->execute($input, $output);
54 3
    }
55
}
56