Timestamp::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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