ValidateExpertCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
namespace Metfan\RabbitSetup\Command;
3
4
use Metfan\RabbitSetup\Container\LoggerProvider;
5
use Metfan\RabbitSetup\Parser\ParseExpertConfig;
6
use Pimple\Container;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
13
/**
14
 * this command help tocheck config file is ok before submit it.
15
 *
16
 * @author Ulrich
17
 * @package Metfan\RabbitSetup\Command
18
 */
19
class ValidateExpertCommand extends Command
20
{
21
    /**
22
     * @var Container
23
     */
24
    private $container;
25
26
    public function __construct(Container $container)
27
    {
28
        parent::__construct();
29
        $this->container = $container;
30
    }
31
32
    protected function configure()
33
    {
34
        $this
35
            ->setName('rsetup:validate:expert')
36
            ->setDescription('Validate configuration file for expert mode')
37
            ->addArgument('configFile', InputArgument::REQUIRED, 'Configuration file');
38
    }
39
40
    protected function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        /**
43
        * set context inside container
44
        */
45
        $this->container->register(new LoggerProvider($output));
46
47
        $parser = new ParseExpertConfig();
48
        $parser->parse($input->getArgument('configFile'));
49
50
        $this->container['logger']->info('<info>File don\'t show errors.</info>');
51
    }
52
53
54
}
55