summaryrefslogtreecommitdiffstats
path: root/src/PurpleCode/PCurl/PCurl.php
diff options
context:
space:
mode:
authortheres <dmarkiew@CNU3429M9W.nsn-intra.net>2014-07-15 09:44:07 +0200
committertheres <dmarkiew@CNU3429M9W.nsn-intra.net>2014-07-15 09:44:07 +0200
commit090e64bd20a40ed55c79025e611ba2c6a45c80df (patch)
treeb9a284b086b69e057386e11333d7ff15a130834d /src/PurpleCode/PCurl/PCurl.php
parent1884e50d534f9ca82527d06861cb7064fe1d9b40 (diff)
downloadphp.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.zip
php.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.tar.gz
php.curl-090e64bd20a40ed55c79025e611ba2c6a45c80df.tar.bz2
PCurl will now return PCurlResponse object instead of raw body. PJsonCurl
also, but will try to parse JSON and throw an exception when fail to parse.
Diffstat (limited to 'src/PurpleCode/PCurl/PCurl.php')
-rw-r--r--src/PurpleCode/PCurl/PCurl.php15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/PurpleCode/PCurl/PCurl.php b/src/PurpleCode/PCurl/PCurl.php
index 9af612c..4e9d4b6 100644
--- a/src/PurpleCode/PCurl/PCurl.php
+++ b/src/PurpleCode/PCurl/PCurl.php
@@ -12,8 +12,10 @@
namespace PurpleCode\PCurl;
require_once 'PCurlException.php';
+require_once 'PCurlResponse.php';
use PurpleCode\PCurl\PCurlException;
+use PurpleCode\PCurl\PCurlResponse;
class PCurl {
@@ -110,9 +112,7 @@ class PCurl {
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);
- $processedResponse = $this->postProcessResponseBody($header, $body);
-
- return $body;
+ return new PCurlResponse($header, $body);
}
/**
@@ -145,15 +145,6 @@ class PCurl {
}
/**
- * Allow to postprocess response body, ex. parse to specified format.
- * @param string $header
- * @param string $body
- */
- protected function postProcessResponseBody($header, $body){
- return $body;
- }
-
- /**
* @return PCurl
*/
public function headers(array $headers) {