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

Breadcrumb

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

function FallbackBuilder::build

Builds and returns a UuidInterface instance using the first builder that succeeds

@psalm-pure

Parameters

CodecInterface $codec The codec to use for building this instance:

string $bytes The byte string from which to construct a UUID:

Return value

UuidInterface an instance of a UUID object

Overrides UuidBuilderInterface::build

File

vendor/ramsey/uuid/src/Builder/FallbackBuilder.php, line 48

Class

FallbackBuilder
FallbackBuilder builds a UUID by stepping through a list of UUID builders until a UUID can be constructed without exceptions

Namespace

Ramsey\Uuid\Builder

Code

public function build(CodecInterface $codec, string $bytes) : UuidInterface {
    $lastBuilderException = null;
    foreach ($this->builders as $builder) {
        try {
            return $builder->build($codec, $bytes);
        } catch (UnableToBuildUuidException $exception) {
            $lastBuilderException = $exception;
            continue;
        }
    }
    throw new BuilderNotFoundException('Could not find a suitable builder for the provided codec and fields', 0, $lastBuilderException);
}

API Navigation

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