GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Timestamp::original()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Frame\Value;
5
6
use Innmind\AMQP\{
7
    Transport\Frame\Value,
8
    TimeContinuum\Format\Timestamp as TimestampFormat,
9
};
10
use Innmind\TimeContinuum\{
11
    PointInTimeInterface,
12
    PointInTime\Earth\PointInTime,
13
    Format\ISO8601,
14
};
15
use Innmind\Math\Algebra\Integer;
16
use Innmind\Stream\Readable;
17
18
final class Timestamp implements Value
19
{
20
    private $value;
21
    private $original;
22
23 14
    public function __construct(PointInTimeInterface $point)
24
    {
25 14
        $this->original = $point;
26 14
    }
27
28 8
    public static function fromStream(Readable $stream): Value
29
    {
30 8
        $time = UnsignedLongLongInteger::fromStream($stream)
31 8
            ->original()
32 8
            ->value();
33
34 8
        return new self(new PointInTime(
35 8
            \date((string) new ISO8601, $time)
36
        ));
37
    }
38
39 9
    public function original(): PointInTimeInterface
40
    {
41 9
        return $this->original;
42
    }
43
44 12
    public function __toString(): string
45
    {
46 12
        return $this->value ?? $this->value = (string) new UnsignedLongLongInteger(
47 12
            new Integer((int) $this->original->format(new TimestampFormat))
48
        );
49
    }
50
}
51