[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/ramsey/uuid/src/Generator/ -> PeclUuidRandomGenerator.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  /**
  18   * PeclUuidRandomGenerator provides functionality to generate strings of random
  19   * binary data using the PECL UUID PHP extension
  20   *
  21   * @link https://pecl.php.net/package/uuid
  22   */
  23  class PeclUuidRandomGenerator implements RandomGeneratorInterface
  24  {
  25      /**
  26       * Generates a string of random binary data of the specified length
  27       *
  28       * @param integer $length The number of bytes of random binary data to generate
  29       * @return string A binary string
  30       */
  31      public function generate($length)
  32      {
  33          $uuid = uuid_create(UUID_TYPE_RANDOM);
  34  
  35          return uuid_parse($uuid);
  36      }
  37  }


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