private function buildAuthorizationHeader(array $params)
    {
        foreach ($params as $key => $value) {
            $params[$key] = $key . '="' . rawurlencode($value) . '"';
        }

        if ($this->realm) {
            array_unshift(
                $params,
                'realm="' . rawurlencode($this->realm) . '"'
            );
        }

        return ['Authorization', 'OAuth ' . implode(', ', $params)];
    }