Test Failed
Push — main ( d2d042...ea42f2 )
by Bingo
13:21
created

ReportDbMetricsValueCmd::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Jabe\Engine\Impl\Metrics\Reporter;
4
5
use Jabe\Engine\Impl\Interceptor\{
6
    CommandInterface,
7
    CommandContext
8
};
9
use Jabe\Engine\Impl\Persistence\Entity\MeterLogEntity;
10
use Jabe\Engine\Impl\Util\ClockUtil;
11
12
class ReportDbMetricsValueCmd implements CommandInterface
13
{
14
    protected $reporterId;
15
    protected $name;
16
    protected $value;
17
18
    public function __construct(string $reporterId, string $name, int $value)
19
    {
20
        $this->reporterId = $reporterId;
21
        $this->name = $name;
22
        $this->value = $value;
23
    }
24
25
    public function execute(CommandContext $commandContext)
26
    {
27
        $commandContext->getMeterLogManager()->insert(new MeterLogEntity($this->name, $this->reporterId, $this->value, ClockUtil::getCurrentTime()->format('c')));
28
        return null;
29
    }
30
}
31