Completed
Push — master ( f91003...7ec665 )
by personal
05:42 queued 03:06
created

InitConfigCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Application\Command;
11
use Hal\Application\Command\Job\QueueFactory;
12
use Hal\Application\Config\ConfigDumper;
13
use Hal\Application\Config\ConfigFactory;
14
use Hal\Application\Rule\DefaultRuleSet;
15
use Hal\Component\Bounds\Bounds;
16
use Hal\Component\Evaluation\Evaluator;
17
use Hal\Component\File\Finder;
18
use Hal\Component\Phar\Updater;
19
use Symfony\Component\Console\Command\Command;
20
use Symfony\Component\Console\Input\InputArgument;
21
use Symfony\Component\Console\Input\InputInterface;
22
use Symfony\Component\Console\Input\InputOption;
23
use Symfony\Component\Console\Output\OutputInterface;
24
25
/**
26
 * Command for updating phar
27
 *
28
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
29
 */
30
class InitConfigCommand extends Command
31
{
32
    /**
33
     * @inheritdoc
34
     */
35
    protected function configure()
36
    {
37
        $this
38
                ->setName('init')
39
                ->setDescription('Create a .phpmetrics.yml config file')
40
        ;
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        $ruleset = new DefaultRuleSet();
49
        $destination = '.phpmetrics.yml';
50
        $dumper = new ConfigDumper($destination, $ruleset);
51
        $dumper->dump();
52
53
        $output->writeln('<info>Done</info>');
54
        return 0;
55
    }
56
57
}
58