VhostListCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Portiere\Command;
4
5
use Portiere\WebServer\ManagerFactory;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Style\SymfonyStyle;
10
11
/**
12
 * Class VhostListCommand.
13
 *
14
 * @author Ignacio Velazquez <[email protected]>
15
 */
16
class VhostListCommand extends Command
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function configure()
22
    {
23
        $this
24
            ->setName('vhost:list')
25
            ->setDescription('List vhosts');
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        $io = new SymfonyStyle($input, $output);
34
        $manager = ManagerFactory::create();
35
36
        $io->table(
37
            ['Vhost Name', 'Enabled'],
38
            $manager->listVhosts()
39
        );
40
    }
41
}
42