GetPathsCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Glamorous\Boiler;
4
5
use Symfony\Component\Console\Helper\Table;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class GetPathsCommand extends ConfigurationCommand
10
{
11
    /**
12
     * Configure the command options.
13
     *
14
     * @return void
15
     */
16
    protected function configure()
17
    {
18
        $this
19
            ->setName('paths')
20
            ->setDescription('List all paths to search for templates');
21
    }
22
23
    /**
24
     * Execute the command.
25
     *
26
     * @param InputInterface $input
27
     * @param OutputInterface $output
28
     *
29
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
30
     *
31
     * @return void
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $paths = $this->configuration->getPaths();
36
37
        if (empty($paths)) {
38
            $output->writeln('<info>No paths set...</info>');
39
40
            return;
41
        }
42
43
        $table = new Table($output);
44
        $table
45
            ->setHeaders(['Path'])
46
            ->setRows(array_map(function ($path) {
47
                return [$path];
48
            }, $paths));
49
        $table->render();
50
    }
51
}
52