GetPathsCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 15
c 1
b 0
f 0
dl 0
loc 41
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 17 2
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