VersionedName   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A jsonSerialize() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TechDeCo\ElasticApmAgent\Message;
5
6
use JsonSerializable;
7
use TechDeCo\ElasticApmAgent\Serialization;
8
9
final class VersionedName implements JsonSerializable
10
{
11
    /**
12
     * @var string
13
     */
14
    private $name;
15
16
    /**
17
     * @var string
18
     */
19
    private $version;
20
21 45
    public function __construct(string $name, string $version)
22
    {
23 45
        $this->name    = $name;
24 45
        $this->version = $version;
25 45
    }
26
27
    /**
28
     * @return mixed[]
29
     */
30 39
    public function jsonSerialize(): array
31
    {
32 39
        return Serialization::filterUnset([
33 39
            'name' => $this->name,
34 39
            'version' => $this->version,
35
        ]);
36
    }
37
}
38