ConfigCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 2
A __construct() 0 4 1
A configure() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the dotfiles project.
7
 *
8
 *     (c) Anthonius Munthi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Dotfiles\Core\Command;
15
16
use Dotfiles\Core\Config\Config;
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Output\OutputInterface;
19
20
class ConfigCommand extends Command
21
{
22
    /**
23
     * @var Config
24
     */
25
    private $config;
26
27
    public function __construct(?string $name = null, Config $config)
28
    {
29
        parent::__construct($name);
30
        $this->config = $config;
31
    }
32
33
    protected function configure(): void
34
    {
35
        $this
36
            ->setName('config')
37
        ;
38
    }
39
40
    protected function execute(InputInterface $input, OutputInterface $output): void
41
    {
42
        $config = $this->config;
43
44
        $params = $config->getAll(true);
45
46
        foreach ($params as $name => $value) {
47
            $output->writeln(sprintf(
48
                '<info>%s</info>=<comment>%s</comment>',
49
                $name,
50
                $value
51
            ));
52
        }
53
    }
54
}
55