Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function fromBinary($uuid, $version = null){
- if (strlen($uuid) < 16) $uuid = $uuid.implode("", array_fill(0, 16 - strlen($uuid), 0));
- elseif (strlen($uuid) > 16) $uuid = substr($uuid, 0, 16);
- if(strlen($uuid) !== 16){
- var_dump($uuid, strlen($uuid));
- throw new \InvalidArgumentException("Must have exactly 16 bytes");
- }
- return new UUID(Binary::readInt(substr($uuid, 0, 4)), Binary::readInt(substr($uuid, 4, 4)), Binary::readInt(substr($uuid, 8, 4)), Binary::readInt(substr($uuid, 12, 4)), $version);
- }
Advertisement