protected static function detectQuote($string) {
        // begin with '(' without ending ')'
        if (preg_match('/^\([^\)]*$/', $string)) {
            return array(')', 1);
        }

        // begin with '"' without ending '"'
        if (preg_match('/^"[^"]*$/', $string)) {
            return array('"', 0);
        }

        // begin with \' without ending '
        if (preg_match('/^\\\\\'[^\']*$/', $string)) {
            return array('\'', 0);
        }

        // '="' exists without ending '"'
        if (preg_match('/^[^"]*="[^"]*$/', $string)) {
            return array('"', 0);
        }

        // '[' exists without ending ']'
        if (preg_match('/^([^"\'].+)?\\[[^\\]]*$/', $string)) {
            return array(']', 0);
        }

        // =\' exists without ending '
        if (preg_match('/^[^\']*=\\\\\'[^\']*$/', $string)) {
            return array('\'', 0);
        }

        // continue to next match when =( exists without ending )
        if (preg_match('/.+(\(+)[^\)]*$/', $string, $m)) {
            return array(')', strlen($m[1]));
        }
    }
protected static function detectQuote($string) {
        // begin with '(' without ending ')'
        if (preg_match('/^\([^\)]*$/', $string)) {
            return array(')', 1);
        }

        // begin with '"' without ending '"'
        if (preg_match('/^"[^"]*$/', $string)) {
            return array('"', 0);
        }

        // begin with \' without ending '
        if (preg_match('/^\\\\\'[^\']*$/', $string)) {
            return array('\'', 0);
        }

        // '="' exists without ending '"'
        if (preg_match('/^[^"]*="[^"]*$/', $string)) {
            return array('"', 0);
        }

        // '[' exists without ending ']'
        if (preg_match('/^([^"\'].+)?\\[[^\\]]*$/', $string)) {
            return array(']', 0);
        }

        // =\' exists without ending '
        if (preg_match('/^[^\']*=\\\\\'[^\']*$/', $string)) {
            return array('\'', 0);
        }

        // continue to next match when =( exists without ending )
        if (preg_match('/.+(\(+)[^\)]*$/', $string, $m)) {
            return array(')', strlen($m[1]));
        }
    }
protected static function detectQuote ( $ string ) { // begin with '(' without ending ')' if ( preg_match ( '/^\([^\)]*$/' , $ string ) ) { return array ( ')' , 1 ) ; } // begin with '"' without ending '"' if ( preg_match ( '/^"[^"]*$/' , $ string ) ) { return array ( '"' , 0 ) ; } // begin with \' without ending ' if ( preg_match ( '/^\\\\\'[^\']*$/' , $ string ) ) { return array ( '\'' , 0 ) ; } // '="' exists without ending '"' if ( preg_match ( '/^[^"]*="[^"]*$/' , $ string ) ) { return array ( '"' , 0 ) ; } // '[' exists without ending ']' if ( preg_match ( '/^([^"\'].+)?\\[[^\\]]*$/' , $ string ) ) { return array ( ']' , 0 ) ; } // =\' exists without ending ' if ( preg_match ( '/^[^\']*=\\\\\'[^\']*$/' , $ string ) ) { return array ( '\'' , 0 ) ; } // continue to next match when =( exists without ending ) if ( preg_match ( '/.+(\(+)[^\)]*$/' , $ string , $ m ) ) { return array ( ')' , strlen ( $ m [ 1 ] ) ) ; } }
Detect quote charactors

@param string $string the string to be detect the quote charactors

@return array<string,integer>|null Expected ending string when quote charactor be detected
Detect quote charactors