コード例 #1
0
ファイル: Resource.php プロジェクト: pithstudio/forrest
 /**
  * Method returns the response for the requested resource
  * @param  string $pURI 
  * @param  array  $pOptions
  * @return mixed
  */
 protected function requestResource($pURL, array $pOptions)
 {
     $options = array_replace_recursive($this->settings['defaults'], $pOptions);
     $format = $options['format'];
     $method = $options['method'];
     $this->setHeaders($options);
     $parameters['headers'] = $this->headers;
     if (isset($options['body'])) {
         $parameters['body'] = $this->setBody($options);
     }
     $request = $this->client->createRequest($method, $pURL, $parameters);
     try {
         $response = $this->client->send($request);
     } catch (RequestException $e) {
         $this->assignExceptions($e);
     }
     return $this->responseFormat($response, $format);
 }