Parses the response.

@param string $response

@return array
554984
private function parseResponse(string $response)
    {
        if (0 === preg_match_all('~--uuid:[a-zA-Z0-9-]+~', $response, $matches, PREG_OFFSET_CAPTURE)) {
            return [[
                'headers' => [
                    'Content-Type'              => 'application/json;charset=UTF-8',
                    'Content-Transfer-Encoding' => 'binary',
                    'Content-ID'                => '<jsonInfos>',
                ],
                'body'    => $response,
            ]];
        }

        $uuids = $matches[0];

        $parts = [];

        for ($i = 0; $i < count($uuids) - 1; $i++) {
            $start = $uuids[$i][1] + strlen($uuids[$i][0]) + 2;
            $parts[] = substr($response, $start, $uuids[$i + 1][1] - $start);
        }

        $responses = [];

        foreach ($parts as $part) {
            list($header, $body) = explode("\r\n\r\n", $part);

            $headers = [];
            foreach (explode("\r\n", $header) as $line) {
                list($key, $value) = explode(':', $line);
                $headers[trim($key)] = trim($value);
            }

            $responses[] = [
                'headers' => $headers,
                'body'    => $body,
            ];
        }

        return $responses;
    }
1195612
protected function prepareResponse($response)
    {
        $header_size = curl_getinfo($this->request, CURLINFO_HEADER_SIZE);
        $headers = substr($response, 0, $header_size);
        $body = substr($response, $header_size);

        return [$headers, $body];
    }
1251447
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $onlineStatuses = [];
            foreach ($jsonData['result'] as $status) {
                $onlineStatuses[] = EntityFactory::createEntity(OnlineStatus::class, [
                    'clientType' => $status['client_type'],
                    'uin' => $status['uin'],
                    'status' => $status['status'],
                ]);
            }

            return new EntityCollection($onlineStatuses);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
1088042
public function parse( Request $request, Response $response )
    {
        $error = parent::parse( $request, $response );

        if ( $error )
        {
            return $error;
        }

        $body = json_decode( $request->getContent() );

        if ( empty( $body ) )
        {
            return self::PARSE;
        }

        if ( empty( $body->method ) || ! isset( $body->params ) )
        {
            return self::INVALID_REQUEST;
        }

        $this->id       = $body->id;
        $this->method   = $body->method;
        $this->params   = $body->params;

        return null;
    }
96269
protected function curl_parse ( $response )
	{
		if (empty($response))
		{
			return array();
		}
	
		@list($headers,$body) = explode("\r\n\r\n",$response,2);
		$lines = explode("\r\n",$headers);

		if (preg_match('@^HTTP/[0-9]\.[0-9] +100@', $lines[0]))
		{
			/* HTTP/1.x 100 Continue
			 * the real data is on the next line
			 */
			@list($headers,$body) = explode("\r\n\r\n",$body,2);
			$lines = explode("\r\n",$headers);
		}
	
		// first line of headers is the HTTP response code 
		$http_line = array_shift($lines);
		if (preg_match('@^HTTP/[0-9]\.[0-9] +([0-9]{3})@', $http_line, $matches))
		{
			$code = $matches[1];
		}
	
		// put the rest of the headers in an array
		$headers = array();
		foreach ($lines as $l)
		{
			list($k, $v) = explode(': ', $l, 2);
			$headers[strtolower($k)] = $v;
		}
	
		return array( 'code' => $code, 'headers' => $headers, 'body' => $body);
	}
1309990
public function getResponse(MessageInterface $response)
    {
        $result = [];

        if (null !== $response) {
            $responseStr = $this->parser->getBodyWithHeaders($response);

            $result = ['response' => $responseStr];
        }

        return $result;
    }
1244360
public function parse_tag_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}

		$arr = [];
		array_map(
			function ( $e ) use ( &$arr ) {
				$arr[] = $e->tag_name;

				return $arr;
			},
			(array) $response
		);

		return $arr;
	}
551047
public function getHeaders($response) {
        $lines = explode(PHP_EOL, $response);

        $headers = [];

        foreach ($lines as $line) {
            $line = trim($line);

            if ($line == '') {
                break;
            }

            if (strpos($line, 'HTTP/') !== false or
                strpos($line, ':') === false
            ) {
                continue;
            }

            list($key, $value) = explode(':', $line, 2);
            $key = trim($key);
            $value = trim($value);
            $values = array_get($headers, $key, []);

            $values[] = $value;
            $headers[$key] = $values;
        }

        return $headers;
    }
3156
protected function parseResponse(Response $response)
    {
        $xml = new \DomDocument();
        $xml->loadXML($response->getBody());

        return XML2Array::createArray($xml->saveXML());
    }
1181502
public static function response($response)
    {
        $result = [];
        if (is_numeric($response)) {
            header('HTTP/1.1 '.$response);
            $result['status'] = $response;
            $result['status_message'] = self::toResponse($response);
            $result['data'] = [];
        } else {
            header('HTTP/1.1 '. 200);
            $result['status'] = 200;
            $result['status_message'] = 'Success';
            $result['data'] = self::superEncode($response);
        }

        $json_response = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        $json_response = str_replace('\\\\', '', $json_response);

        return $json_response;
    }
226590
protected function decode($response)
    {
        $lines = array_slice(explode("\n", trim($response)), 1);

        $result = [];
        foreach ($lines as $line) {
            if ($line[0] == '-') {
                $result[] = trim(ltrim($line, '- '));
            } else {
                $key = strtok($line, ': ');
                if ($key) {
                    $value = ltrim(trim(strtok('')), ' ');

                    if (is_numeric($value)) {
                        $value = $value + 0;
                    }

                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }
51419
private function parseYubicoResponse($response)
    {
        $lines = array_filter(explode("\r\n", $response));
        $responseArray = array();

        foreach ($lines as $line) {
            list($key, $value) = explode('=', $line, 2);

            $responseArray[$key] = $value;
        }

        return $responseArray;
    }
983726
private function parseResponse($response) {
        $response = trim($response);
        $this->responseStatus = (int) substr($response, 0, 3);
        $this->response = substr($response, 4);
    }
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;
	}
1243104
protected function parseLookupResponse(Response $response)
    {
        $responseData = $response->getBody();
        $responseObject = json_decode($responseData);
        $definitionsData = $responseObject->def;
        $definitions = [];
        foreach ($definitionsData as $definitionData) {
            $definitions[] = new DictionaryDefinition($definitionData);
        }
        return $definitions;
    }
650802
protected function _result($response)
    {
        $this->_info();

        $this->curl->close();

        $this->_default();

        if( Json::check($response) )
        {
            return json_decode($response);
        }
        elseif( XML\Check::check($response) )
        {
            return XML\Parser::simple($response);
        }
        else
        {
            return $response;
        }
    }
1228525
protected function getResultFromResponse(Response $response)
    {
        $result = [];

        foreach ($response->getData() as $element) {
            $item = $this->getAttributes($element);
            $item['type'] = $element['type'];
            $result[] = new ElasticIndexer($item);
        }

        return $result;
    }