Failed Conditions
Pull Request — 0.3 (#20)
by jean
12:27
created

StatDumpCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: darkilliant
5
 * Date: 6/24/18
6
 * Time: 11:32 AM
7
 */
8
9
namespace Darkilliant\ProcessBundle\Command;
10
11
12
use Darkilliant\ProcessBundle\StatDumper\StatCliDumper;
13
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Input\InputOption;
16
use Symfony\Component\Console\Output\OutputInterface;
17
use Symfony\Component\Console\Style\SymfonyStyle;
18
19
class StatDumpCommand extends ContainerAwareCommand
20
{
21
    protected function configure()
22
    {
23
        $this->setName('process:stats');
24
        $this->addOption('zoom', null, InputOption::VALUE_REQUIRED, 'zoom', null);
25
    }
26
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        $outputHelper = new SymfonyStyle($input, $output);
30
31
        $data = json_decode(file_get_contents('stat.json'), true);
32
33
        $this->getContainer()->get(StatCliDumper::class)->dump(
34
            $data['stats'],
35
            $data['total'],
36
            $input->getOption('zoom'),
37
            $outputHelper
38
        );
39
    }
40
}