/** * @param Net_HTTP_Request $request * @param array $parameters * @param boolean $to_headers * * @return Net_HTTP_Request */ protected function build_request(Net_HTTP_Request $request, array $parameters = array(), $to_headers = false) { $builder = $this->is_version(1) ? Service_OAuth::RequestBuilder($request) : new Service_OAuth_RequestBuilder2($request); $builder->consumer($this->consumer)->token($this->token)->add_parameters($parameters)->sign($this->options['sign_method'])->to_parameters(); if ($to_headers) { $builder->to_headers(); } return $builder->request; }