Added PackageName() to \ncc\Utilities > Validate

This commit is contained in:
Netkas 2022-07-26 18:57:58 -04:00
parent a3236ba1ee
commit 13df43113a

View file

@ -108,4 +108,25 @@
return true;
}
/**
* Validates if the package name is valid
*
* @param $input
* @return bool
*/
public static function PackageName($input): bool
{
if($input == null)
{
return false;
}
if((bool)preg_match("/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/", $input) == false)
{
return false;
}
return true;
}
}