Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FrozenClock
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 now
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace Phexium\Plugin\Clock\Adapter;
11
12use DateTimeImmutable;
13use Override;
14use Phexium\Plugin\Clock\Port\ClockInterface;
15
16final readonly class FrozenClock implements ClockInterface
17{
18    private DateTimeImmutable $frozenDate;
19
20    public function __construct(string $isoDate)
21    {
22        $this->frozenDate = new DateTimeImmutable($isoDate);
23    }
24
25    #[Override]
26    public function now(): DateTimeImmutable
27    {
28        return $this->frozenDate;
29    }
30}