MetricsFlushCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Flagbit\Bundle\MetricsBundle\Command;
4
5
use Flagbit\Bundle\MetricsBundle\Provider\ProviderInvoker;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class MetricsFlushCommand extends Command
11
{
12
    /**
13
     * @var ProviderInvoker
14
     */
15
    private $providerInvoker;
16
17
    /**
18
     * @param ProviderInvoker $providerInvoker
19
     */
20
    public function __construct(ProviderInvoker $providerInvoker)
21
    {
22
        parent::__construct('flagbit:metrics:flush');
23
        $this->providerInvoker = $providerInvoker;
24
    }
25
26
    protected function configure()
27
    {
28
        $this->setDescription('Collect metrics and flush them to the metric collector servers');
29
    }
30
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        // Collect job status metrics
34
        $this->providerInvoker->collectMetrics();
35
        // Flush metric results
36
        $this->providerInvoker->onTerminate();
37
    }
38
}
39