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\BuilderCode
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);
}