• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RikudouSage / DynamoDbCachePsr6 / 22776633301

06 Mar 2026 06:30PM UTC coverage: 96.325% (-3.1%) from 99.458%
22776633301

Pull #37

github

web-flow
Merge 7098dad0a into e612f9757
Pull Request #37: Chore: Replace clock

0 of 12 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

367 of 381 relevant lines covered (96.33%)

10.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Helper/ClockHelper.php
1
<?php
2

3
namespace Rikudou\DynamoDbCache\Helper;
4

5
use DateTimeImmutable;
6
use Psr\Clock\ClockInterface as PsrClock;
7
use Rikudou\Clock\ClockInterface as RikudouClock;
8

9
/**
10
 * @internal
11
 */
12
final class ClockHelper
13
{
14
    public static function psrClock(RikudouClock|PsrClock|null $clock = null): PsrClock
15
    {
NEW
16
        if ($clock instanceof RikudouClock) {
×
NEW
17
            trigger_error(sprintf('%s is deprecated, use %s instead', RikudouClock::class, PsrClock::class), E_USER_DEPRECATED);
×
18
        }
19

NEW
20
        return new class ($clock) implements PsrClock {
×
21
            public function __construct(
22
                private RikudouClock|PsrClock|null $clock = null,
23
            ) {
NEW
24
            }
×
25

26
            public function now(): DateTimeImmutable
27
            {
NEW
28
                if ($this->clock !== null) {
×
NEW
29
                    return DateTimeImmutable::createFromInterface($this->clock->now());
×
30
                }
31

NEW
32
                return new DateTimeImmutable();
×
33
            }
NEW
34
        };
×
35
    }
36

37
    public static function fixedTimeClock(DateTimeImmutable $now): PsrClock
38
    {
NEW
39
        return new class($now) implements PsrClock {
×
40
            public function __construct(
41
                private DateTimeImmutable $now,
42
            ) {
NEW
43
            }
×
44

45
            public function now(): DateTimeImmutable
46
            {
NEW
47
                return $this->now;
×
48
            }
NEW
49
        };
×
50
    }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc