Total Complexity | 5 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
5 | final class StoredMetricMutator implements MetricMutatorInterface |
||
6 | { |
||
7 | /** @var MetricStorageInterface */ |
||
8 | private $storage; |
||
9 | |||
10 | 4 | public function __construct(MetricStorageInterface $storage) |
|
11 | { |
||
12 | 4 | $this->storage = $storage; |
|
13 | 4 | } |
|
14 | |||
15 | /** {@inheritdoc} */ |
||
16 | 2 | public function adjustMetricValue(float $delta, string $name, array $tags = []): void |
|
17 | { |
||
18 | 2 | $this->findOrCreateMetric($name, $tags)->adjust($delta); |
|
19 | 2 | } |
|
20 | |||
21 | /** {@inheritdoc} */ |
||
22 | 2 | public function setMetricValue(float $value, string $name, array $tags = []): void |
|
23 | { |
||
24 | 2 | $this->findOrCreateMetric($name, $tags)->setValue($value); |
|
25 | 2 | } |
|
26 | |||
27 | 4 | private function findOrCreateMetric(string $name, array $tags): MutableMetricInterface |
|
30 | } |
||
31 | } |
||
32 |