protected function buildQuery($params, $separator = '&', $noQuotes = true, $subList = false)
    {
        if (empty($params)) {
            return '';
        }

        //encode both keys and values
        $keys = $this->encode(array_keys($params));
        $values = $this->encode(array_values($params));

        $params = array_combine($keys, $values);

        // Parameters are sorted by name, using lexicographical byte value ordering.
        // http://oauth.net/core/1.0/#rfc.section.9.1.1
        uksort($params, 'strcmp');

        // Turn params array into an array of "key=value" strings
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                // If two or more parameters share the same name,
                // they are sorted by their value. OAuth Spec: 9.1.1 (1)
                natsort($value);
                $params[$key] = $this->buildQuery($value, $separator, $noQuotes, true);
                continue;
            }

            if (!$noQuotes) {
                $value = '"'.$value.'"';
            }

            $params[$key] = $value;
        }

        if ($subList) {
            return $params;
        }

        foreach ($params as $key => $value) {
            $params[$key] = $key.'='.$value;
        }

        return implode($separator, $params);
    }
protected function buildQuery($params, $separator = '&', $noQuotes = true, $subList = false)
    {
        if (empty($params)) {
            return '';
        }

        //encode both keys and values
        $keys = $this->encode(array_keys($params));
        $values = $this->encode(array_values($params));

        $params = array_combine($keys, $values);

        // Parameters are sorted by name, using lexicographical byte value ordering.
        // http://oauth.net/core/1.0/#rfc.section.9.1.1
        uksort($params, 'strcmp');

        // Turn params array into an array of "key=value" strings
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                // If two or more parameters share the same name,
                // they are sorted by their value. OAuth Spec: 9.1.1 (1)
                natsort($value);
                $params[$key] = $this->buildQuery($value, $separator, $noQuotes, true);
                continue;
            }

            if (!$noQuotes) {
                $value = '"'.$value.'"';
            }

            $params[$key] = $value;
        }

        if ($subList) {
            return $params;
        }

        foreach ($params as $key => $value) {
            $params[$key] = $key.'='.$value;
        }

        return implode($separator, $params);
    }
protected function buildQuery ( $ params , $ separator = '&' , $ noQuotes = true , $ subList = false ) { if ( empty ( $ params ) ) { return '' ; } //encode both keys and values $ keys = $ this -> encode ( array_keys ( $ params ) ) ; $ values = $ this -> encode ( array_values ( $ params ) ) ; $ params = array_combine ( $ keys , $ values ) ; // Parameters are sorted by name, using lexicographical byte value ordering. // http://oauth.net/core/1.0/#rfc.section.9.1.1 uksort ( $ params , 'strcmp' ) ; // Turn params array into an array of "key=value" strings foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) { // If two or more parameters share the same name, // they are sorted by their value. OAuth Spec: 9.1.1 (1) natsort ( $ value ) ; $ params [ $ key ] = $ this -> buildQuery ( $ value , $ separator , $ noQuotes , true ) ; continue ; } if ( ! $ noQuotes ) { $ value = '"' . $ value . '"' ; } $ params [ $ key ] = $ value ; } if ( $ subList ) { return $ params ; } foreach ( $ params as $ key => $ value ) { $ params [ $ key ] = $ key . '=' . $ value ; } return implode ( $ separator , $ params ) ; }
Generates an oauth standard query

@param *array $params    Parameters to include in the authentecation request
@param string $separator The parameter delimeter
@param bool   $noQuotes  Whether to escape string by quotes
@param bool   $subList   If to include "sub lists"

@return string
Generates an oauth standard query