Total Complexity | 6 |
Total Lines | 82 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class Agent implements \JsonSerializable |
||
8 | { |
||
9 | const NAME = 'zoilomora/elastic-apm-agent-php'; |
||
10 | const VERSION = '1.0.0'; |
||
11 | |||
12 | /** |
||
13 | * Name of the Elastic APM agent, e.g. "Python" |
||
14 | * |
||
15 | * @var string|null |
||
16 | */ |
||
17 | private $name; |
||
18 | |||
19 | /** |
||
20 | * Version of the Elastic APM agent, e.g."1.0.0" |
||
21 | * |
||
22 | * @var string|null |
||
23 | */ |
||
24 | private $version; |
||
25 | |||
26 | /** |
||
27 | * Free format ID used for metrics correlation by some agents |
||
28 | * |
||
29 | * @var string|null |
||
30 | */ |
||
31 | private $ephemeralId; |
||
32 | |||
33 | /** |
||
34 | * @param string|null $name |
||
35 | * @param string|null $version |
||
36 | * @param string|null $ephemeralId |
||
37 | */ |
||
38 | 20 | private function __construct($name = null, $version = null, $ephemeralId = null) |
|
39 | { |
||
40 | 20 | $this->name = $name; |
|
41 | 20 | $this->version = $version; |
|
42 | 20 | $this->ephemeralId = $ephemeralId; |
|
43 | 20 | } |
|
44 | |||
45 | /** |
||
46 | * @return string|null |
||
47 | */ |
||
48 | 1 | public function name() |
|
49 | { |
||
50 | 1 | return $this->name; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string|null |
||
55 | */ |
||
56 | 1 | public function version() |
|
57 | { |
||
58 | 1 | return $this->version; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return string|null |
||
63 | */ |
||
64 | 1 | public function ephemeralId() |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return Agent |
||
71 | */ |
||
72 | 20 | public static function discover() |
|
77 | 20 | ); |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return array |
||
82 | */ |
||
83 | 1 | public function jsonSerialize() |
|
89 | 1 | ]; |
|
90 | } |
||
92 |