System   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 53
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
ccs 17
cts 17
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A onArchitecture() 0 7 1
A atHost() 0 7 1
A onPlatform() 0 7 1
A jsonSerialize() 0 8 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 System implements JsonSerializable
10
{
11
    /**
12
     * @var string|null
13
     */
14
    private $architecture;
15
16
    /**
17
     * @var string|null
18
     */
19
    private $hostname;
20
21
    /**
22
     * @var string|null
23
     */
24
    private $platform;
25
26 1
    public function onArchitecture(string $architecture): self
27
    {
28 1
        $me               = clone $this;
29 1
        $me->architecture = $architecture;
30
31 1
        return $me;
32
    }
33
34 31
    public function atHost(string $hostname): self
35
    {
36 31
        $me           = clone $this;
37 31
        $me->hostname = $hostname;
38
39 31
        return $me;
40
    }
41
42 1
    public function onPlatform(string $platform): self
43
    {
44 1
        $me           = clone $this;
45 1
        $me->platform = $platform;
46
47 1
        return $me;
48
    }
49
50
    /**
51
     * @return mixed[]
52
     */
53 26
    public function jsonSerialize(): array
54
    {
55 26
        return Serialization::filterUnset([
56 26
            'hostname' => $this->hostname,
57 26
            'architecture' => $this->architecture,
58 26
            'platform' => $this->platform,
59
        ]);
60
    }
61
}
62