| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class LaravelDatadogHelper extends \Datadogstatsd |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * {@inheritdoc} |
||
| 10 | */ |
||
| 11 | public static function send($data, $sampleRate = 1.0, array $tags = null) |
||
| 12 | { |
||
| 13 | $prefixedData = self::prefixData($data); |
||
| 14 | parent::send($prefixedData, $sampleRate, $tags); |
||
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Takes normal data array from Datadogstatsd library and adds the Laravel prefix functionality |
||
| 19 | * |
||
| 20 | * @param $data |
||
| 21 | * @return array |
||
| 22 | */ |
||
| 23 | protected static function prefixData($data) |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Prefixes a metric name if one is available via config |
||
| 35 | * |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | protected static function prefix($metric) |
||
| 47 | } |
||
| 48 | } |
||
| 49 |