CoreFiles by mySites.guru
SystemClock.php32 lines, 655 bytes, from Joomla_6.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 5.4.0-beta3
md5
2017ceb17b317c525a893679196fb88e
sha1
9af7a0a81f000cd449cf608a73e99a17bf8ff8e8
sha256
131572160cd175f711b93a2533c20c69755c2ffeada3e5c977b90b924ab48857
<?php
declare(strict_types=1);

namespace Lcobucci\Clock;

use DateTimeImmutable;
use DateTimeZone;

use function date_default_timezone_get;

/** @immutable */
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 17 releases, Joomla 6.0.0-beta1 to 6.1.0-alpha1. See them all, or every version of this file.