CoreFiles by mySites.guru
SystemClock.php31 lines, 637 bytes, from Joomla_5.2.3-Stable-Full_Package.zip
Raw History Compare with 5.2.2
md5
ba2fe0a3ea6cfdce60696dc920f82052
sha1
13e2fcc7505e5e96635e1a466028a76d9bb301e0
sha256
1dd16689ad5e30a04c1c2b5b539c213ed0bddd74cd1f870fcbb1ee104189bb43
<?php
declare(strict_types=1);

namespace Lcobucci\Clock;

use DateTimeImmutable;
use DateTimeZone;

use function date_default_timezone_get;

final class SystemClock implements Clock
{
    public function __construct(private readonly DateTimeZone $timezone)
    {
    }

    public static function fromUTC(): self
    {
        return new self(new DateTimeZone('UTC'));
    }

    public static function fromSystemTimezone(): self
    {
        return new self(new DateTimeZone(date_default_timezone_get()));
    }

    public function now(): DateTimeImmutable
    {
        return new DateTimeImmutable('now', $this->timezone);
    }
}

The same content is in 109 releases, Joomla 5.0.0-alpha1 to 6.0.0-alpha3. See them all, or every version of this file.