MetricsFlushCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 29
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 4 1
A execute() 0 7 1
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