CoreFiles by mySites.guru
TimeBasedUuidFactory.php38 lines, 880 bytes, from Joomla_5.1.0-alpha4-Alpha-Full_Package.zip
Raw History Compare with 5.1.0-alpha3
md5
8aabc6f3f7b3d592cd36cefae80020b0
sha1
72cb3a4764ec325ef49fcba92902abb6b38b314d
sha256
cb1ae2c90f7c90863b51cba935cbe2b847e8ec4ebd2b5718d9e1ea16e1faafe6
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Uid\Factory;

use Symfony\Component\Uid\TimeBasedUidInterface;
use Symfony\Component\Uid\Uuid;

class TimeBasedUuidFactory
{
    private string $class;
    private ?Uuid $node;

    public function __construct(string $class, Uuid $node = null)
    {
        $this->class = $class;
        $this->node = $node;
    }

    public function create(\DateTimeInterface $time = null): Uuid&TimeBasedUidInterface
    {
        $class = $this->class;

        if (null === $time && null === $this->node) {
            return new $class();
        }

        return new $class($class::generate($time, $this->node));
    }
}

The same content is in 22 releases, Joomla 5.0.0-alpha1 to 5.1.0-alpha4. See them all, or every version of this file.