public static function isComment($str, $end = false)
    {
        $len = strlen($str);
        if ($len === 0) {
            return null;
        }
        if ($str[0] === '#') {
            return Token::FLAG_COMMENT_BASH;
        } elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
            return (($len > 2) && ($str[2] === '!')) ?
                Token::FLAG_COMMENT_MYSQL_CMD : Token::FLAG_COMMENT_C;
        } elseif (($len > 1) && ($str[0] === '*') && ($str[1] === '/')) {
            return Token::FLAG_COMMENT_C;
        } elseif (($len > 2) && ($str[0] === '-')
            && ($str[1] === '-') && static::isWhitespace($str[2])
        ) {
            return Token::FLAG_COMMENT_SQL;
        } elseif (($len === 2) && $end && ($str[0] === '-') && ($str[1] === '-')) {
            return Token::FLAG_COMMENT_SQL;
        }

        return null;
    }
public static function isComment($str, $end = false)
    {
        $len = strlen($str);
        if ($len === 0) {
            return null;
        }
        if ($str[0] === '#') {
            return Token::FLAG_COMMENT_BASH;
        } elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
            return (($len > 2) && ($str[2] === '!')) ?
                Token::FLAG_COMMENT_MYSQL_CMD : Token::FLAG_COMMENT_C;
        } elseif (($len > 1) && ($str[0] === '*') && ($str[1] === '/')) {
            return Token::FLAG_COMMENT_C;
        } elseif (($len > 2) && ($str[0] === '-')
            && ($str[1] === '-') && static::isWhitespace($str[2])
        ) {
            return Token::FLAG_COMMENT_SQL;
        } elseif (($len === 2) && $end && ($str[0] === '-') && ($str[1] === '-')) {
            return Token::FLAG_COMMENT_SQL;
        }

        return null;
    }
public static function isComment ( $ str , $ end = false ) { $ len = strlen ( $ str ) ; if ( $ len === 0 ) { return null ; } if ( $ str [ 0 ] === '#' ) { return Token :: FLAG_COMMENT_BASH ; } elseif ( ( $ len > 1 ) && ( $ str [ 0 ] === '/' ) && ( $ str [ 1 ] === '*' ) ) { return ( ( $ len > 2 ) && ( $ str [ 2 ] === '!' ) ) ? Token :: FLAG_COMMENT_MYSQL_CMD : Token :: FLAG_COMMENT_C ; } elseif ( ( $ len > 1 ) && ( $ str [ 0 ] === '*' ) && ( $ str [ 1 ] === '/' ) ) { return Token :: FLAG_COMMENT_C ; } elseif ( ( $ len > 2 ) && ( $ str [ 0 ] === '-' ) && ( $ str [ 1 ] === '-' ) && static :: isWhitespace ( $ str [ 2 ] ) ) { return Token :: FLAG_COMMENT_SQL ; } elseif ( ( $ len === 2 ) && $ end && ( $ str [ 0 ] === '-' ) && ( $ str [ 1 ] === '-' ) ) { return Token :: FLAG_COMMENT_SQL ; } return null ; }
Checks if the given string is the beginning of a whitespace.

@param string $str string to be checked
@param mixed  $end

@return int the appropriate flag for the comment type
Checks if the given string is the beginning of a whitespace .