Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | final class Metric implements MutableMetricInterface |
||
8 | { |
||
9 | /** @var string */ |
||
10 | private $name; |
||
11 | /** @var float */ |
||
12 | private $value; |
||
13 | /** @var string[] */ |
||
14 | private $tags; |
||
15 | |||
16 | /** |
||
17 | * Metric constructor. |
||
18 | * |
||
19 | * @param string $name |
||
20 | * @param float $value |
||
21 | * @param string[] $tags |
||
22 | */ |
||
23 | 3 | public function __construct(string $name, float $value, array $tags = []) |
|
24 | { |
||
25 | 3 | $this->name = $name; |
|
26 | 3 | $this->value = $value; |
|
27 | 3 | $this->tags = $tags; |
|
28 | 3 | } |
|
29 | |||
30 | /** {@inheritdoc} */ |
||
31 | 1 | public function getName(): string |
|
32 | { |
||
33 | 1 | return $this->name; |
|
34 | } |
||
35 | |||
36 | /** {@inheritdoc} */ |
||
37 | 3 | public function resolve(): float |
|
38 | { |
||
39 | 3 | return $this->value; |
|
40 | } |
||
41 | |||
42 | /** {@inheritdoc} */ |
||
43 | 1 | public function getTags(): array |
|
44 | { |
||
45 | 1 | return $this->tags; |
|
46 | } |
||
47 | |||
48 | /** {@inheritdoc} */ |
||
49 | 1 | public function adjust(float $delta): void |
|
50 | { |
||
51 | 1 | $this->value += $delta; |
|
52 | 1 | } |
|
53 | |||
54 | /** {@inheritdoc} */ |
||
55 | 1 | public function setValue(float $value): void |
|
58 | 1 | } |
|
59 | } |
||
60 |