Failed Conditions
Pull Request — 0.3 (#20)
by jean
06:00
created

StatDumpCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 11
rs 9.9
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
use Darkilliant\ProcessBundle\StatDumper\StatCliDumper;
12
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Input\InputOption;
15
use Symfony\Component\Console\Output\OutputInterface;
16
use Symfony\Component\Console\Style\SymfonyStyle;
17
18
/**
19
 * @internal
20
 * Class StatDumpCommand
21
 *
22
 * @codeCoverageIgnore
23
 */
24
class StatDumpCommand extends ContainerAwareCommand
25
{
26
    protected function configure()
27
    {
28
        $this->setName('process:stats');
29
        $this->addOption('zoom', null, InputOption::VALUE_NONE, 'zoom', null);
30
    }
31
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $outputHelper = new SymfonyStyle($input, $output);
35
36
        $data = json_decode(file_get_contents('stat.json'), true);
37
38
        $this->getContainer()->get(StatCliDumper::class)->dump(
39
            $data['stats'],
40
            $data['total'],
41
            $input->getOption('zoom'),
42
            $outputHelper
43
        );
44
    }
45
}
46