Added PackageName() to \ncc\Utilities > Validate
This commit is contained in:
parent
a3236ba1ee
commit
13df43113a
1 changed files with 21 additions and 0 deletions
|
@ -108,4 +108,25 @@
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue