VersionedName::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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