protected function composeAuthorizationHeader(array $params, $realm = '')
    {
        $header = 'OAuth';
        $headerParams = [];
        if (!empty($realm)) {
            $headerParams[] = 'realm="' . rawurlencode($realm) . '"';
        }
        foreach ($params as $key => $value) {
            if (substr_compare($key, 'oauth', 0, 5)) {
                continue;
            }
            $headerParams[] = rawurlencode($key) . '="' . rawurlencode($value) . '"';
        }
        if (!empty($headerParams)) {
            $header .= ' ' . implode(', ', $headerParams);
        }

        return ['Authorization' => $header];
    }
protected function composeAuthorizationHeader(array $params, $realm = '')
    {
        $header = 'OAuth';
        $headerParams = [];
        if (!empty($realm)) {
            $headerParams[] = 'realm="' . rawurlencode($realm) . '"';
        }
        foreach ($params as $key => $value) {
            if (substr_compare($key, 'oauth', 0, 5)) {
                continue;
            }
            $headerParams[] = rawurlencode($key) . '="' . rawurlencode($value) . '"';
        }
        if (!empty($headerParams)) {
            $header .= ' ' . implode(', ', $headerParams);
        }

        return ['Authorization' => $header];
    }
protected function composeAuthorizationHeader ( array $ params , $ realm = '' ) { $ header = 'OAuth' ; $ headerParams = [ ] ; if ( ! empty ( $ realm ) ) { $ headerParams [ ] = 'realm="' . rawurlencode ( $ realm ) . '"' ; } foreach ( $ params as $ key => $ value ) { if ( substr_compare ( $ key , 'oauth' , 0 , 5 ) ) { continue ; } $ headerParams [ ] = rawurlencode ( $ key ) . '="' . rawurlencode ( $ value ) . '"' ; } if ( ! empty ( $ headerParams ) ) { $ header .= ' ' . implode ( ', ' , $ headerParams ) ; } return [ 'Authorization' => $ header ] ; }
Composes authorization header.
@param array $params request params.
@param string $realm authorization realm.
@return array authorization header in format: [name => content].
Composes authorization header .