core/Module/ModuleHelper.php
public static function toNameStrict( string $name )
	{
		$len = strlen($name);
		if( $len < 1 || $len > 50 )
		{
			return false;
		}

		$name = str_replace("-", "_", $name);
		if(strpos($name, "__") !== false || $name[0] === "_" || $len > 1 && $name[$len-1] === "_")
		{
			return false;
		}

		if( strpos($name, "_") !== false || ! ctype_upper($name[0]) )
		{
			$name = self::toName($name);
		}

		if( is_numeric($name[0]) || preg_match('/[^a-zA-Z0-9]/', $name ) )
		{
			return false;
		}

		return $name;
	}
public static function toNameStrict( string $name )
	{
		$len = strlen($name);
		if( $len < 1 || $len > 50 )
		{
			return false;
		}

		$name = str_replace("-", "_", $name);
		if(strpos($name, "__") !== false || $name[0] === "_" || $len > 1 && $name[$len-1] === "_")
		{
			return false;
		}

		if( strpos($name, "_") !== false || ! ctype_upper($name[0]) )
		{
			$name = self::toName($name);
		}

		if( is_numeric($name[0]) || preg_match('/[^a-zA-Z0-9]/', $name ) )
		{
			return false;
		}

		return $name;
	}
public static function toNameStrict ( string $ name ) { $ len = strlen ( $ name ) ; if ( $ len < 1 || $ len > 50 ) { return false ; } $ name = str_replace ( "-" , "_" , $ name ) ; if ( strpos ( $ name , "__" ) !== false || $ name [ 0 ] === "_" || $ len > 1 && $ name [ $ len - 1 ] === "_" ) { return false ; } if ( strpos ( $ name , "_" ) !== false || ! ctype_upper ( $ name [ 0 ] ) ) { $ name = self :: toName ( $ name ) ; } if ( is_numeric ( $ name [ 0 ] ) || preg_match ( '/[^a-zA-Z0-9]/' , $ name ) ) { return false ; } return $ name ; }
Format and validate module name

@param string $name
@return bool|string
Format and validate module name