diff --git a/src/FreshMail/RestApi.php b/src/FreshMail/RestApi.php index 7153449..2b8dad7 100644 --- a/src/FreshMail/RestApi.php +++ b/src/FreshMail/RestApi.php @@ -15,7 +15,7 @@ class RestApi const HOST = 'https://api.freshmail.com/'; const PREFIX = 'rest/'; - CONST DEFAULT_FILE_PATH = '/tmp/'; + const DEFAULT_FILE_PATH = '/tmp/'; /** * @var string @@ -27,7 +27,14 @@ class RestApi */ private $strApiKey; + /** + * @var array + */ private $response = null; + + /** + * @var string + */ private $rawResponse = null; /** @@ -48,7 +55,7 @@ class RestApi /** * Get errors. * - * @return array + * @return array|null */ public function getErrors() { @@ -59,9 +66,9 @@ public function getErrors() return null; } - /** - * Get response. - * + /** + * Get response. + * * @return array */ public function getResponse() @@ -69,20 +76,20 @@ public function getResponse() return $this->response; } - /** - * Get raw response. - * - * @return array + /** + * Get raw response. + * + * @return string */ public function getRawResponse() { return $this->rawResponse; } - /** - * Get HTTP code. - * - * @return array + /** + * Get HTTP code. + * + * @return int */ public function getHttpCode() { @@ -131,6 +138,18 @@ public function setContentType($contentType) return $this; } + /** + * Fire request + * + * @param string $strUrl - URL path + * @param array $arrParams - Data + * @param bool $returnRawResponse - Return raw response + * + * @return array|string - Response + * + * @throws \FreshMail\RestException + * @throws \Exception + */ public function doRequest($strUrl, $arrParams = array(), $returnRawResponse = false) { if (empty($arrParams)) { @@ -188,6 +207,13 @@ public function doRequest($strUrl, $arrParams = array(), $returnRawResponse = fa return $this->response; } + /** + * Parse Curl response + * + * @param resource $cUrl + * + * @return void + */ private function getResponseFromHeaders($cUrl) { $headerSize = curl_getinfo($cUrl, CURLINFO_HEADER_SIZE);