public static function fromFullyQualifiedString(string $fully_qualified_string)
{
$key = get_called_class() . '|' . $fully_qualified_string;
return self::memoizeStatic($key, function () use($fully_qualified_string) {
// Split off the alternate_id
$parts = explode(',', $fully_qualified_string);
$fqsen_string = $parts[0];
$alternate_id = (int) ($parts[1] ?? 0);
assert(is_int($alternate_id), "Alternate must be an integer");
$parts = explode('\\', $fqsen_string);
$name = array_pop($parts);
assert(!empty($name), "The name cannot be empty");
$namespace = '\\' . implode('\\', array_filter($parts));
assert(!empty($namespace), "The namespace cannot be empty");
assert($namespace[0] === '\\', "The first character of the namespace must be \\");
return static::make($namespace, $name, $alternate_id);
});
}