StatsdStore::storeTimer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JildertMiedema\SystemMonitor\Store;
6
7
use JildertMiedema\SystemMonitor\System\MeasurementStore;
8
use League\StatsD\Client;
9
10
final class StatsdStore implements MeasurementStore
11
{
12
    /**
13
     * @var Client
14
     */
15
    private $client;
16
17
    public function __construct(Client $client)
18
    {
19
        $this->client = $client;
20
    }
21
22
    /**
23
     * Store a time based measurement.
24
     *
25
     * @param string           $name  The name of the measurement
26
     * @param int|float|string $value The value of the measurement
27
     */
28
    public function storeTimer(string $name, $value)
29
    {
30
        $this->client->timing($name, $value);
31
    }
32
33
    /**
34
     * Store a gauge measurement.
35
     *
36
     * @param string           $name  The name of the measurement
37
     * @param int|float|string $value The value of the measurement
38
     */
39
    public function storeGauge(string $name, $value)
40
    {
41
        $this->client->gauge($name, $value);
42
    }
43
}
44