Completed
Pull Request — master (#27)
by Frederic
05:43
created

DogStatsDMetricService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A increment() 0 4 1
A timing() 0 4 1
1
<?php
2
3
namespace Burrow\Metric;
4
5
use Beberlei\Metrics\Collector\DogStatsD as Collector;
6
7
class DogStatsDMetricService implements MetricService
8
{
9
    /** @var Collector */
10
    private $collector;
11
12
    /** @var array */
13
    private $tags;
14
15
    /**
16
     * MetricService constructor.
17
     *
18
     * @param Collector $collector
19
     * @param array     $tags
20
     */
21 9
    public function __construct(Collector $collector, array $tags = [])
22
    {
23 9
        $this->collector = $collector;
24 9
        $this->tags = $tags;
25 9
    }
26
27
    /**
28
     * @param $key
29
     */
30 3
    public function increment($key)
31
    {
32 3
        $this->collector->increment($key, $this->tags);
33 3
    }
34
35
    /**
36
     * @param $key
37
     * @param float $timeInMs
38
     */
39 3
    public function timing($key, $timeInMs)
40
    {
41 3
        $this->collector->timing($key, $timeInMs, $this->tags);
42 3
    }
43
}
44