/** * @ignore * Intermediate fetch function * @param string $method The HTTP method * @param string $url The API endpoint * @param string $call The API method to call * @param array $params Additional parameters * @return mixed */ private function fetch($method, $url, $call = '', array $params = array(), array $headers = array()) { $url .= $call; // Make the API call via the consumer $response = $this->OAuth->fetch($method, $url, $headers, $params); // Format the response and return switch ($this->responseFormat) { case 'json': return json_encode($response); case 'jsonp': $response = json_encode($response); return $this->callback . '(' . $response . ')'; default: return $response; } }