Timestamp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 4 1
A __toString() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TechDeCo\ElasticApmAgent\Message;
5
6
use DateTimeImmutable;
7
use JsonSerializable;
8
9
final class Timestamp extends DateTimeImmutable implements JsonSerializable
10
{
11 64
    public function jsonSerialize(): string
12
    {
13 64
        return $this->__toString();
14
    }
15
16 64
    public function __toString(): string
17
    {
18 64
        $utc = $this->setTimezone(new \DateTimeZone('UTC'));
19
20 64
        return $utc->format('Y-m-d\TH:i:s.u\Z');
21
    }
22
}
23