Lines 100.00% 3 / 3
Methods 100.00% 3 / 3
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 recordStart 100.00% 1 / 1 100.00% 1 / 1 1
 getStartedAt 100.00% 1 / 1 100.00% 1 / 1 1
11final class DaemonStartTime
12{
13    private ?Instant $startedAt = null;
14
15    public function __construct(private readonly Clock $clock) {}
16
17    public function recordStart(): void
18    {
19        $this->startedAt = $this->clock->getNow();
20    }
21
22    public function getStartedAt(): Instant
23    {
24        return $this->startedAt ?? throw new LogicException('The daemon start time is read before the run started.');
25    }
26}