ConfigExampleCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 10
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * neuralyzer : Data Anonymization Library and CLI Tool
7
 *
8
 * PHP Version 7.2
9
 *
10
 * @author Emmanuel Dyan
11
 * @author Rémi Sauvat
12
 *
13
 * @copyright 2020 Emmanuel Dyan
14
 *
15
 * @package edyan/neuralyzer
16
 *
17
 * @license GNU General Public License v2.0
18
 *
19
 * @link https://github.com/edyan/neuralyzer
20
 */
21
22
namespace Edyan\Neuralyzer\Console\Commands;
23
24
use Symfony\Component\Console\Command\Command;
25
use Symfony\Component\Console\Input\InputInterface;
26
use Symfony\Component\Console\Output\OutputInterface;
27
28
/**
29
 * Command to generate an example config file
30
 */
31
class ConfigExampleCommand extends Command
32
{
33
    /**
34
     * Set the command shortcut to be used in configuration
35
     *
36
     * @var string
37
     */
38
    protected $command = 'config:example';
39
40
    protected function configure(): void
41
    {
42 28
        // First command : Test the DB Connexion
43
        $this->setName($this->command)
44
            ->setDescription(
45 28
                'Generate an example configuration for the Anonymizer'
46 28
            )->setHelp(
47 28
                'This command will take all default values from the config validation' . PHP_EOL .
48 28
                "Usage: neuralyzer <info>{$this->command}</info>"
49 28
            );
50 28
    }
51
52 28
    protected function execute(InputInterface $input, OutputInterface $output): int
53
    {
54
        $dumper = new \Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper();
55
        $config = $dumper->dump(
56
            new \Edyan\Neuralyzer\Configuration\ConfigDefinition()
57
        );
58
59
        $output->writeLn($config);
60
61
        return Command::SUCCESS;
62 1
    }
63
}
64