function LazyUuidFromString::getTimestamp
@psalm-suppress UndefinedInterfaceMethod @psalm-suppress DeprecatedMethod @psalm-suppress MixedArgument @psalm-suppress MixedMethodCall
Deprecated
Use { { instance, you may call { and use the arbitrary-precision math library of your choice to convert it to a string integer.
See also
UuidInterface::getFields()} to get a
FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
Rfc4122FieldsInterface::getTimestamp()}
File
-
vendor/
ramsey/ uuid/ src/ Lazy/ LazyUuidFromString.php, line 523
Class
- LazyUuidFromString
- Lazy version of a UUID: its format has not been determined yet, so it is mostly only usable for string/bytes conversion. This object optimizes instantiation, serialization and string conversion time, at the cost of increased overhead for more advanced…
Namespace
Ramsey\Uuid\LazyCode
public function getTimestamp() : string {
$instance = $this->unwrapped ?? $this->unwrap();
$fields = $instance->getFields();
if ($fields->getVersion() !== 1) {
throw new UnsupportedOperationException('Not a time-based UUID');
}
return $instance->getNumberConverter()
->fromHex($fields->getTimestamp()
->toString());
}