Passed
Push — 0.4 ( 487c21 )
by jean
05:10
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
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\Command;
6
7
use Darkilliant\ProcessBundle\StatDumper\StatCliDumper;
8
use Darkilliant\ProcessBundle\StatDumper\StatsCalculator;
9
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Output\OutputInterface;
13
use Symfony\Component\Console\Style\SymfonyStyle;
14
15
/**
16
 * @internal
17
 * Class StatDumpCommand
18
 *
19
 * @codeCoverageIgnore
20
 */
21
class StatDumpCommand extends ContainerAwareCommand
22
{
23
    protected function configure()
24
    {
25
        $this->setName('process:stats');
26
        $this->addOption('zoom', null, InputOption::VALUE_NONE, 'zoom', null);
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        $outputHelper = new SymfonyStyle($input, $output);
32
33
        $data = json_decode(file_get_contents('stat.json'), true);
34
35
        $statCalculator = new StatsCalculator();
36
37
        $this->getContainer()->get(StatCliDumper::class)->dump(
38
            $statCalculator->calcul($data)['stats'] ?? [],
39
            $outputHelper
40
        );
41
    }
42
}
43