@param $response

@return array
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;
    }
559322
protected function checkResponseForErrors($response)
    {
        if (isset($response["error"])) {
            $msg = [];
            $parts = ["code", "description", "details"];
            
            foreach ($parts as $part) {
                if (!empty($response["error"][$part])) {
                    $msg[] = $part.": ".$response["error"][$part];
                }
            }

            $msg = implode(" | ", $msg);
            $code = $response["error"]["code"];

            if (!array_key_exists($code, $this->exceptions)) {
                $code = "default";
            }

            throw new $this->exceptions[$code]($msg);
        }

        return $response;
    }
77991
protected function _setHeaders($response)
    {
        $headers = $this->getConfig('headers');

        if (!is_array($headers)) {
            return $response;
        }

        return $response
            ->withHeader($headers['limit'], (string)$this->getConfig('limit'))
            ->withHeader($headers['remaining'], (string)$this->_getRemainingConnections())
            ->withHeader(
                $headers['reset'],
                (string)Cache::read($this->_getCacheExpirationKey(), static::$cacheConfig)
            );
    }
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;
	}
450864
public function parseResponse(ResponseInterface $response)
    {
        $body = $response->getBody()->getContents();
        return [
            'code' => $response->getStatusCode(),
            'headers' => $response->getHeaders(),
            'body' => ($this->isValidJson($body)) ? json_decode($body,
                true) : $body,
        ];
    }
660653
protected function formatResponse($response)
    {
        if (static::FORMAT_ARRAY === $this->output) {
            $response = static::xmlToArray($response);
        } else if (static::FORMAT_JSON === $this->output) {
            $response = static::xmlToArray($response);
            $response = json_encode($response, JSON_UNESCAPED_SLASHES);
        }

        return $response;
    }
1326829
public function parseResponse($response)
    {
        $slots = array();
        try {
            $json = new Json();
            $obj = $json->decode($response);
            if (is_object($obj)) {
                if (is_object($obj->slots)) {
                    foreach ($obj->slots as $key => $content) {
                        $cn = new self($content);
                        $slots[$key] = $cn;
                    }
                }
            }
        } catch (\Exception $e) {
        }

        return $slots;
    }
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;
    }
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;
    }
877000
private function buildResults(Response $response): array
    {
        $data = $response->getData();
        $results = [];

        if (!isset($data['hits']['hits'])) {
            return $results;
        }

        foreach ($data['hits']['hits'] as $hit) {
            $results[] = new Result($hit);
        }

        return $results;
    }
1309990
public function getResponse(MessageInterface $response)
    {
        $result = [];

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

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

        return $result;
    }
590512
public function clean(Response $response)
    {
        $body = $response->json();
        $resources = $body["list"]["resources"];

        $cleaned = array_pop($resources);

        return $cleaned;
    }
877236
protected function GetResultFormResponse($response)
    {
        $aNeededResponseParameterToCheck = array('ret_status' => '', 'ret_errormsg' => '', 'trxuser_id' => '', 'trx_amount' => '', 'trx_currency' => '', 'ret_authcode' => '', 'ret_trx_number' => '', 'ret_param_checksum' => '');
        preg_match('/<a href=".*'.self::URL_PARAMETER_NAME.'\\/(success|error)\?(.*)">/', $response, $aMatch);
        if (count($aMatch) > 2) {
            $aResponseParts = explode('&', $aMatch[2]);
            foreach ($aResponseParts as $sRepsponsePart) {
                $aResponseKeyValue = explode('=', $sRepsponsePart);
                if (2 == count($aResponseKeyValue) && array_key_exists($aResponseKeyValue[0], $aNeededResponseParameterToCheck)) {
                    $aNeededResponseParameterToCheck[$aResponseKeyValue[0]] = $aResponseKeyValue[1];
                }
            }
        }

        return $aNeededResponseParameterToCheck;
    }
1039264
public function parseData(array $response)
    {
        $key = str_replace('.', '_', $this->getMethod()) . '_response';
        return array_key_exists($key, $response) ? $response[$key] : null;
    }
897507
protected function handleResponse(ResponseInterface $response)
    {
        $status = $response->getStatusCode();

        $data = (string) $response->getBody();
        $jsonResponseData = json_decode($data, false);
        $body = $data && $jsonResponseData === null ? $data : $jsonResponseData;

        return ['status_code' => $status, 'body' => $body];
    }
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;
    }
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;
    }