public static function fromString(string
$ulid):
static { if (36 === \
strlen($ulid) &&
preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di',
$ulid)) { $ulid =
uuid_parse($ulid);
} elseif (22 === \
strlen($ulid) && 22 ===
strspn($ulid, BinaryUtil::BASE58
[''
])) { $ulid =
str_pad(BinaryUtil::
fromBase($ulid, BinaryUtil::BASE58
), 16, "\0", \STR_PAD_LEFT
);
} if (16 !== \
strlen($ulid)) { return match (strtr($ulid, 'z', 'Z'
)) { self::NIL =>
new NilUlid(),
self::MAX =>
new MaxUlid(),
default =>
new static($ulid),
};
} $ulid =
bin2hex($ulid);
$ulid =
sprintf('%02s%04s%04s%04s%04s%04s%04s',
base_convert(substr($ulid, 0, 2
), 16, 32
),
base_convert(substr($ulid, 2, 5
), 16, 32
),
base_convert(substr($ulid, 7, 5
), 16, 32
),
base_convert(substr($ulid, 12, 5
), 16, 32
),
base_convert(substr($ulid, 17, 5
), 16, 32
),