static public function validateName($name)
    {
        if (null !== $name && !is_string($name)) {
            throw new Exception\UnexpectedTypeException($name, 'string, integer or null');
        }

        if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'The name "%s" contains illegal characters. Names should only contain letters, numbers and underscores.',
                $name
            ));
        }
    }
static public function validateName($name)
    {
        if (null !== $name && !is_string($name)) {
            throw new Exception\UnexpectedTypeException($name, 'string, integer or null');
        }

        if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'The name "%s" contains illegal characters. Names should only contain letters, numbers and underscores.',
                $name
            ));
        }
    }
static public function validateName ( $ name ) { if ( null !== $ name && ! is_string ( $ name ) ) { throw new Exception \ UnexpectedTypeException ( $ name , 'string, integer or null' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9_]+$/' , $ name ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'The name "%s" contains illegal characters. Names should only contain letters, numbers and underscores.' , $ name ) ) ; } }
Validates whether the given variable is a valid name.

@param string $name The tested name

@throws Exception\UnexpectedTypeException  If the name is not a string.
@throws Exception\InvalidArgumentException If the name contains invalid characters.
Validates whether the given variable is a valid name .