Age::ms()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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