GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 11139b...2b076b )
by Dominic
03:41
created

Metric   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 5
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 36
ccs 17
cts 17
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setTags() 0 4 1
A getData() 0 16 3
1
<?php
2
3
namespace Vend\Statsd\Datadog;
4
5
use Vend\Statsd\Metric as BaseMetric;
6
7
class Metric extends BaseMetric
8
{
9
    /**
10
     * @var array<string,string>
11
     */
12
    protected $tags = [];
13
14 7
    public function __construct($key, $value, $type, array $tags = [])
15
    {
16 7
        parent::__construct($key, $value, $type);
17
18 7
        $this->setTags($tags);
19 7
    }
20
21 7
    public function setTags(array $tags = [])
22
    {
23 7
        $this->tags = $tags;
24 7
    }
25
26 7
    public function getData()
27
    {
28 7
        $result = parent::getData();
29
30 7
        if (!empty($this->tags)) {
31 1
            $tags = [];
32
33 1
            array_walk($this->tags, function ($tagValue, $tagName) use (&$tags) {
34 1
                $tags[] = is_integer($tagName) ? $tagValue : $tagName . ':' . $tagValue;
35 1
            });
36
37 1
            $result .= '|#' . implode(',', $tags);
38 1
        }
39
40 7
        return $result;
41
    }
42
}
43