Completed
Push — master ( 4803b3...959101 )
by Frank
03:46
created

SystemClock   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dateTime() 0 4 1
A pointInTime() 0 4 1
1
<?php
2
3
namespace EventSauce\EventSourcing\Time;
4
5
use DateTimeImmutable;
6
use EventSauce\EventSourcing\PointInTime;
7
8
class SystemClock implements Clock
9
{
10 2
    public function dateTime(): DateTimeImmutable
11
    {
12 2
        return DateTimeImmutable::createFromFormat('U.u', sprintf('%.6f', microtime(true)));
13
    }
14
15 1
    public function pointInTime(): PointInTime
16
    {
17 1
        return PointInTime::fromDateTime($this->dateTime());
18
    }
19
}