Age   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 38
ccs 7
cts 7
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 4 1
A ms() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Events\Common\Message;
4
5
/**
6
 * Age
7
 */
8
final class Age implements \JsonSerializable
9
{
10
    /**
11
     * The age of the message in milliseconds.
12
     *
13
     * If the instrumented messaging framework provides a timestamp for the message, agents may use it.
14
     * Otherwise, the sending agent can add a timestamp in milliseconds since the Unix epoch to
15
     * the message's metadata to be retrieved by the receiving agent.
16
     *
17
     * If a timestamp is not available, agents should omit this field.
18
     *
19
     * @var int|null
20
     */
21
    private $ms;
22
23
    /**
24
     * @param int|null $ms
25
     */
26 3
    public function __construct($ms = null)
27
    {
28 3
        $this->ms = $ms;
29 3
    }
30
31
    /**
32
     * @return int|null
33
     */
34 1
    public function ms()
35
    {
36 1
        return $this->ms;
37
    }
38
39
    /**
40
     * @return array
41
     */
42 1
    public function jsonSerialize()
43
    {
44
        return [
45 1
            'ms' => $this->ms,
46 1
        ];
47
    }
48
}
49