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

NexusPHP / framework / 16868376028

02 Aug 2025 01:15PM UTC coverage: 100.0%. Remained the same
16868376028

push

github

paulbalandan
Remove use of deprecated `DATE_RFC7231` constant

1 of 1 new or added line in 1 file covered. (100.0%)

1176 of 1176 relevant lines covered (100.0%)

9.77 hits per line

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

100.0
/src/Nexus/Clock/SystemClock.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of the Nexus framework.
7
 *
8
 * (c) John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Nexus\Clock;
15

16
/**
17
 * A clock that relies on the system time.
18
 *
19
 * @immutable
20
 */
21
final readonly class SystemClock implements Clock
22
{
23
    private \DateTimeZone $timezone;
24

25
    public function __construct(\DateTimeZone|string $timezone)
26
    {
27
        $this->timezone = \is_string($timezone) ? new \DateTimeZone($timezone) : $timezone;
8✔
28
    }
29

30
    #[\Override]
31
    public function now(): \DateTimeImmutable
32
    {
33
        return new \DateTimeImmutable('now', $this->timezone);
8✔
34
    }
35

36
    #[\Override]
37
    public function sleep(float|int $seconds): void
38
    {
39
        if ($seconds <= 0) {
4✔
40
            return;
2✔
41
        }
42

43
        $microseconds = (int) ($seconds * 1_000_000);
2✔
44
        $seconds = (int) floor($microseconds / 1_000_000);
2✔
45
        $microseconds %= 1_000_000;
2✔
46

47
        sleep($seconds);
2✔
48
        usleep($microseconds);
2✔
49
    }
50
}
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