@param string $response

@return array
189366
protected function getVerificationResult($response)
    {
        if (!isset($this->verificationResult[$response])) {
            $postFields = [
                'secret'   => $this->secretKey,
                'response' => $response,
            ];

            if ($this->ip) {
                $postFields['remoteip'] = $this->ip;
            }

            $handle = \curl_init(self::VERIFY_URL);

            \curl_setopt($handle, CURLOPT_POST, \count($postFields));
            \curl_setopt($handle, CURLOPT_POSTFIELDS, \http_build_query($postFields));
            \curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);

            \curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
            \curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);

            $result = \curl_exec($handle);

            if (!$result || !\is_string($result)) {
                return [];
            }

            $this->verificationResult[$response] = \json_decode($result, true);
        }

        return $this->verificationResult[$response];
    }
22046
protected function parseCurlResponse($response)
    {
        $pattern = '|HTTP/\d\.\d.*?$.*?\r\n\r\n|ims';
        preg_match($pattern, $response, $matches);
        $header = $matches[0];
        // Remove headers from the response body
        $body = str_replace($header, '', $response);

        return [
            'header' => $header,
            'body' => $body
        ];
    }
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;
	}
63602
protected function respond($response)
    {
        if (!isset($response[0])) {
            $success = !(array_key_exists('type', $response) && $response['type'] == 'error')
                && !(array_key_exists('status', $response) && $response['status'] == 'error');

            return $this->mapResponse($success, $response);
        }

        $responses = [];

        foreach ($response as $responds) {
            $success = !(array_key_exists('type', $response) && $response['type'] == 'error')
                && !(array_key_exists('status', $response) && $response['status'] == 'error');

            $responses[] = $this->mapResponse($success, $responds);
        }

        return $responses;
    }
670089
public static function parseResponse($response)
    {
        $response = is_array($response) ? $response : json_decode($response, true);

        if ( $response && $response['code'] == self::COSAPI_SUCCESS) {
            return $response;
        }

        return false;
    }
350603
public function filter($response)
    {
        $filter = $this->_request->getParam(static::FILTER_PARAMETER);
        if (!is_string($filter)) {
            return $response;
        }
        $filterArray = $this->parse($filter);
        if ($filterArray === null) {
            return $response;
        }
        $partialResponse = $this->applyFilter($response, $filterArray);
        return $partialResponse;
    }
1309990
public function getResponse(MessageInterface $response)
    {
        $result = [];

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

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

        return $result;
    }
1230521
private function formatResponse($response)
    {
        $this->last_response = $response;

        if (!empty($response['body'])) {
            return json_decode($response['body'], true);
        }

        return false;
    }
919727
protected function getResultFromResponse(Response $response)
    {
        $result = [];

        foreach ($response->getData() as $element) {
            $attributes = $this->getAttributes($element);
            $attributes['type'] = $element['type'];

            $result[] = $attributes;
        }

        return $result;
    }
507052
private function _parseResponse($response) {
    list($headerContent, ) = explode("\r\n\r\n", $response);
    $header = $this->_parseHttpSocketHeader($headerContent);
    $response = trim(stristr($response, "\r\n\r\n"), "\r\n");

    $ret = array();
    $ret["result"] =
        (isset($header['Content-Encoding']) &&
         trim($header['Content-Encoding']) == 'gzip') ?
        $this->_gzdecode($response, $header) : $this->_checkChunk($response, $header);
    $ret["info"]["http_code"] =
        isset($header["http_code"]) ? $header["http_code"] : 0;
    $ret["info"]["headers"] = $header;

    return $ret;
  }
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);
    }
779336
protected function respond($response)
    {
        if (Arr::get($response, 'object') === 'list') {
            if (!empty($response['data'])) {
                foreach ($response['data'] as $responseItem) {
                    $success = Arr::get($responseItem, 'object', 'error') !== 'error';

                    $responses[] = $this->mapResponse($success, $responseItem);
                }

                return $responses;
            } else {
                $response = $response['data'];
            }
        }

        $success = Arr::get($response, 'object', 'error') !== 'error';

        return $this->mapResponse($success, $response);
    }
86586
public function generateHeadersFor(HTTPResponse $response)
    {
        return array_filter([
            'Last-Modified' => $this->generateLastModifiedHeader(),
            'Vary' => $this->generateVaryHeader($response),
            'Cache-Control' => $this->generateCacheHeader(),
            'Expires' => $this->generateExpiresHeader(),
        ]);
    }
342553
public function parse_meta_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}
		$arr      = [];
		$response = [ $response ];

		array_filter(
			$response,
			function ( $e ) use ( &$arr ) {
				$arr['private']      = $e->is_private;
				$arr['last_updated'] = $e->updated_on;
				$arr['watchers']     = 0;
				$arr['forks']        = 0;
				$arr['open_issues']  = 0;
			}
		);

		return $arr;
	}
703314
private static function getErrorMessage($response)
    {
        $body = $response->getBody();

        $message = json_decode($body, true);
        $errors = [];

        if (is_array($message) && isset($message['errors'])) {
            $errors = $message['errors'];
        }

        if ($body == self::RATE_LIMIT_ERROR_MESSAGE) {
            $errors = [self::RATE_LIMIT_ERROR_MESSAGE];
        }

        return $errors;
    }
192545
private function persistResponse(Response $response)
    {
        $headers = $response->headers->all();
        $headers['X-Status'] = [$response->getStatusCode()];

        return $headers;
    }
789331
private function paramsFrom($response)
    {
        $attribs = $response->attributes();

        $params = array();
        $params['result'] = (string) $response->result;
        $params['pasref'] = (string) $response->pasref;
        $params['order_id'] = (string) $response->orderid;
        $params['batch_id'] = (string) $response->batchid;
        $params['account'] = (string) $response->account;
        $params['timestamp'] = (int) $attribs['timestamp'];

        return $params;
    }