Parse Response XML to array.

@param \Psr\Http\Message\ResponseInterface|string $response

@return \EntWeChat\Support\Collection
515696
protected function parseResponse($response)
    {
        if ($response instanceof ResponseInterface) {
            $response = $response->getBody();
        }

        return new Collection((array) XML::parse($response));
    }
58616
function parseResponse($response, $format) {
		if (isset ( $format )) {
			switch ($format) {
				case "pdf" :
					$theResponse = $response;
					break;
				case "json" :
					$theResponse = json_decode ( $response, true );
					break;
				default :
					$theResponse = simplexml_load_string ( $response );
					break;
			}
		}
		return $theResponse;
	}
760389
protected function parseResponse(ResponseInterface $response)
    {
        $content = (string) $response->getBody();

        if(strpos($content, "callback") !== false){
            $lpos = strpos($content, "(");
            $rpos = strrpos($content, ")");
            $content  = substr($content, $lpos + 1, $rpos - $lpos -1);

            return $this->parseJson($content);
        } else if(strpos($content, "access_token=") !== false) {
            $result = array();
            parse_str($content, $result);
            return $result;
        } else {
            return parent::parseResponse($response);
        }
    }
1076700
protected function parseResponse( Response$response ):array
	{
		$headers= $response->headers;
		$body= $this->achieveSerializer( $this->response_content_type )->decode( $response->body );

		return $this->response_transformer->transform(
			[
				'headers'=> $headers,
				'body'=> $body,
			]
		);
	}
514176
protected function unserializeResponse($response = null){
        switch($this->getEndpoint()){
            case "json":
                return json_decode($response,true);
                break;
            case "xml":
                return (array) json_decode(json_encode(simplexml_load_string($response, null, LIBXML_NOCDATA)),true);
                break;
            default:
                throw new \ErrorException('Invalid response type');
                break;
        }
    }
1358918
private function _parseResponse(Response $response)
    {
        switch ($this->_format) {
            case self::FORMAT_JSON:
                return json_decode($response, $this->_isJsonDecodeAssoc);
                break;
            default:
                return $response;
        }
    }
377468
public function parseXml($response)
    {
        parent::parseXml($response);
        $listSubscriptionsResultXml = new \SimpleXMLElement($response);
        $this->_subscriptionInfos = [];
        foreach ($listSubscriptionsResultXml->entry as $entry) {
            $subscriptionInfo = new SubscriptionInfo();
            $subscriptionInfo->parseXml($entry->asXML());
            $this->_subscriptionInfos[] = $subscriptionInfo;
        }
    }
254860
public function parseResponse($response)
    {
        $array = [];

        $exploded = explode('&', $response);

        foreach ($exploded as $explode) {
            $line = explode('=', $explode);

            if (isset($line[1])) {
                $array[$line[0]] = urldecode($line[1]);
            } else {
                $array[] = $explode;
            }
        }

        return $array;
    }
783867
protected function serializeResponse($response)
    {
        /** @var ResponseInterface $response */
        $serialized = serialize([
            $response->getStatusCode(),
            $response->getHeaders(),
            $response->getBody()->getContents(),
        ]);

        //subsequent calls need to access the stream from the beginning
        $response->getBody()->rewind();

        return $serialized;
    }
182668
public function parseXml($response)
    {
        parent::parseXml($response);
        $listRulesResultXml = new \SimpleXMLElement($response);
        $this->_ruleInfos = [];

        foreach ($listRulesResultXml->entry as $entry) {
            $ruleInfo = new RuleInfo();
            $ruleInfo->parseXml($entry->asXML());
            $this->_ruleInfos[] = $ruleInfo;
        }
    }
844196
protected function fetchCorreiosServices(Response $response)
    {
        $xml = simplexml_load_string($response->getBody()->getContents());
        $results = json_decode(json_encode($xml->Servicos))->cServico;

        if (! is_array($results)) {
            return [get_object_vars($results)];
        }

        return array_map('get_object_vars', $results);
    }
141222
private function parse($body)
    {
        $xml = simplexml_load_string($body);

        $data = $xml->xpath('//soap:Body');

        $response = array();

        foreach ($data as $node) {
            $this->parseElement($response, $node);
        }

        return $response;
    }
880174
private static function getHeaderAndBody($response) {
    $header = self::http_parse_headers(substr($response, 0, strrpos($response,"\r\n\r\n")));
    $body = substr($response, strrpos($response,"\r\n\r\n")+4);

    return array($header,$body);
  }
1170659
protected function parseResponse(ResponseInterface $response)
    {
        $content = (string)$response->getBody();
        $type = $this->getContentType($response);

        if (strpos($type, 'urlencoded') !== false) {
            parse_str($content, $parsed);

            return $parsed;
        }

        // Attempt to parse the string as JSON regardless of content type,
        // since some providers use non-standard content types. Only throw an
        // exception if the JSON could not be parsed when it was expected to.
        try {
            return $this->parseJson($content);
        } catch (UnexpectedValueException $e) {
            if (strpos($type, 'json') !== false) {
                throw $e;
            }

            return $content;
        }
    }
1039264
public function parseData(array $response)
    {
        $key = str_replace('.', '_', $this->getMethod()) . '_response';
        return array_key_exists($key, $response) ? $response[$key] : null;
    }
449999
protected function parseResponseHeaders(Response $response, string $headerString)
    {
        foreach (array_filter(explode("\r\n\r\n", $headerString)) as $responseHeader) {
            $header = new Header();
            foreach (explode("\r\n", $responseHeader) as $headerLine) {
                $parts = explode(':', $headerLine, 2);
                if (count($parts) === 2) {
                    $header->set(trim($parts[0]), trim($parts[1]));
                }
            }
            $response->addHeader($header);
        }
        return $this;
    }
401068
private function parse($response_xml)
  {
      $xml = simplexml_load_string($response_xml);
      $response = array();

      $response['error_code'] = (string) $xml->ERRORCODE;
      $response['message'] = (string) $xml->ERRORMESSAGE;
      $response['reference'] = (string) $xml->REFERENCE;
      $response['proxypay_ref'] = (string) $xml->PROXYPAYREF;
      $response['sequence'] = (string) $xml->SEQUENCE;

      return $response;
  }