[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/ramsey/uuid/src/Generator/ -> TimeGeneratorFactory.php (source)

   1  <?php
   2  /**
   3   * This file is part of the ramsey/uuid library
   4   *
   5   * For the full copyright and license information, please view the LICENSE
   6   * file that was distributed with this source code.
   7   *
   8   * @copyright Copyright (c) Ben Ramsey <[email protected]>
   9   * @license http://opensource.org/licenses/MIT MIT
  10   * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
  11   * @link https://packagist.org/packages/ramsey/uuid Packagist
  12   * @link https://github.com/ramsey/uuid GitHub
  13   */
  14  
  15  namespace Ramsey\Uuid\Generator;
  16  
  17  use Ramsey\Uuid\Converter\TimeConverterInterface;
  18  use Ramsey\Uuid\Provider\NodeProviderInterface;
  19  use Ramsey\Uuid\Provider\TimeProviderInterface;
  20  
  21  /**
  22   * A factory for retrieving a time generator, based on the environment
  23   */
  24  class TimeGeneratorFactory
  25  {
  26      /**
  27       * @var NodeProviderInterface
  28       */
  29      private $nodeProvider;
  30  
  31      /**
  32       * @var TimeConverterInterface
  33       */
  34      private $timeConverter;
  35  
  36      /**
  37       * @var TimeProviderInterface
  38       */
  39      private $timeProvider;
  40  
  41      /**
  42       * Constructs a `TimeGeneratorFactory` using a node provider, time converter,
  43       * and time provider
  44       *
  45       * @param NodeProviderInterface $nodeProvider
  46       * @param TimeConverterInterface $timeConverter
  47       * @param TimeProviderInterface $timeProvider
  48       */
  49      public function __construct(
  50          NodeProviderInterface $nodeProvider,
  51          TimeConverterInterface $timeConverter,
  52          TimeProviderInterface $timeProvider
  53      ) {
  54          $this->nodeProvider = $nodeProvider;
  55          $this->timeConverter = $timeConverter;
  56          $this->timeProvider = $timeProvider;
  57      }
  58  
  59      /**
  60       * Returns a default time generator, based on the current environment
  61       *
  62       * @return TimeGeneratorInterface
  63       */
  64      public function getGenerator()
  65      {
  66          return new DefaultTimeGenerator(
  67              $this->nodeProvider,
  68              $this->timeConverter,
  69              $this->timeProvider
  70          );
  71      }
  72  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer