Skip to content

Commit

Permalink
remove redundant method, add a new default.
Browse files Browse the repository at this point in the history
  • Loading branch information
N1ghteyes committed Feb 25, 2019
1 parent cc13c52 commit 352f4a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/apicore/structure/apicore.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,6 @@ public function __call($name, $arguments)
return $response;
}

/**
* Function to process the response from Guzzle, based on the expected format
* @param $response
* @return mixed
*/
public function processResult($response){
$type = array_shift($response->getHeader('Content-Type'));
$this->rawResponse = (string)$response->getBody();
$this->httpStatus = $response->getStatusCode();

switch($type){
case 'application/json':
default:
$this->processedResponse = json_decode($this->rawResponse);
break;
}
return $this;
}

/**
* Function to get the last result returned by an API call.
* @return mixed
Expand Down
2 changes: 2 additions & 0 deletions src/apicore/structure/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public static function processResult($guzzleResponse){
self::$response->url = $guzzleResponse->getHeaderLine('Location');

switch(self::$response->dataType){
case 'text/html': //for now, as some Apis dont set correct headers for XML.
//@todo add the ability to override these defaults before a request is made.
case 'text/xml':
self::$response->data = self::$response->xml2array(simplexml_load_string(self::$response->rawBodyData));
break;
Expand Down

0 comments on commit 352f4a4

Please sign in to comment.