ExtensionTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A wrapSendDataWithMetricPrefix() 0 11 3
A setMetricsPrefix() 0 3 1
1
<?php namespace ChaseConey\LaravelDatadogHelper\Datadog;
2
3
trait ExtensionTrait
4
{
5
    protected $metricsPrefix;
6
7
    public function setMetricsPrefix($metricsPrefix)
8
    {
9
        $this->metricsPrefix = $metricsPrefix;
10
    }
11
12
    protected function wrapSendDataWithMetricPrefix($data)
13
    {
14
        if (!$this->metricsPrefix) {
15
            return $data;
16
        }
17
18
        $wrapped = [];
19
        foreach ($data as $metric => $stat) {
20
            $wrapped[$this->metricsPrefix . '.'. $metric] = $stat;
21
        }
22
        return $wrapped;
23
    }
24
}
25