Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RandomBytesGenerator.php

class RandomBytesGenerator

RandomBytesGenerator generates strings of random binary data using the built-in `random_bytes()` PHP function

@link http://php.net/random_bytes random_bytes()

Hierarchy

  • class \Ramsey\Uuid\Generator\RandomBytesGenerator implements \Ramsey\Uuid\Generator\RandomGeneratorInterface

Expanded class hierarchy of RandomBytesGenerator

File

vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php, line 26

Namespace

Ramsey\Uuid\Generator
View source
class RandomBytesGenerator implements RandomGeneratorInterface {
    
    /**
     * @throws RandomSourceException if random_bytes() throws an exception/error
     *
     * @inheritDoc
     */
    public function generate(int $length) : string {
        try {
            return random_bytes($length);
        } catch (Throwable $exception) {
            throw new RandomSourceException($exception->getMessage(), (int) $exception->getCode(), $exception);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
RandomBytesGenerator::generate public function @inheritDoc Overrides RandomGeneratorInterface::generate

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal