@param Response $response

@return array
@throws EntityNotFoundException
340605
protected function getResultFromResponse(Response $response)
    {
        $included     = $this->getIncludedArray($response->getIncluded());
        $includedFull = $this->getIncludedArray($response->getIncluded(), false);

        $result = [];
        foreach ($response->getData() as $element) {
            $type   = $element['attributes']['type'];
            $entity = $includedFull[$type][$element['attributes'][substr($type, 0, -1) . 'Id']];

            if (is_null($mapperClass = $this->getMapperClass($type))) {
                throw new EntityNotFoundException("Entity mapper class for $type was not found");
            }

            $result[] = $this->createObject($mapperClass, $entity, $included);
        }

        return $result;
    }
1184865
protected function parseResponse($response)
    {
        $result = [];

        // processing results
        parse_str($response, $result);

        // stripping slashes
        $result = array_map(array($this, 'decode'), $result);

        return $result;
    }
989981
private function getCspHeaders(Response $response)
    {
        $headers = [];

        if ($response->headers->has('Content-Security-Policy')) {
            $headers['Content-Security-Policy'] = $this->parseDirectives($response->headers->get('Content-Security-Policy'));
        }

        if ($response->headers->has('Content-Security-Policy-Report-Only')) {
            $headers['Content-Security-Policy-Report-Only'] = $this->parseDirectives($response->headers->get('Content-Security-Policy-Report-Only'));
        }

        if ($response->headers->has('X-Content-Security-Policy')) {
            $headers['X-Content-Security-Policy'] = $this->parseDirectives($response->headers->get('X-Content-Security-Policy'));
        }

        return $headers;
    }
355625
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            //成员在线状态
            $statuses = (new Collection($jsonData['result']['mem_status']))->combine('uin', function ($entity) {
                return $entity;
            })->toArray();
            //成员基本信息
            $ruins = (new Collection($jsonData['result']['info']['mem_list']))->combine('mem_uin', 'ruin')
                ->toArray();
            //讨论组基本详情
            $discussData = $jsonData['result']['info'];
            $discussDetailData = [
                'did' => $discussData['did'],
                'name' => $discussData['discu_name'],
            ];
            $members = [];
            foreach ($jsonData['result']['mem_info'] as $memberData) {
                $uin = $memberData['uin'];
                $members[] = EntityFactory::createEntity(DiscussMember::class, [
                   'uin' => $uin,
                   'nick' => $memberData['nick'],
                   'clientType' => isset($statuses[$uin]) ? $statuses[$uin]['client_type'] : null,
                   'status' => isset($statuses[$uin]) ? $statuses[$uin]['status'] : null,
                   'ruin' => isset($ruins[$uin]) ? $ruins[$uin] : null,
                ]);
            }
            $discussDetailData['members'] = new EntityCollection($members);

            return EntityFactory::createEntity(DiscussDetail::class, $discussDetailData);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
919727
protected function getResultFromResponse(Response $response)
    {
        $result = [];

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

            $result[] = $attributes;
        }

        return $result;
    }
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;
    }
1121221
protected function findMetaHeaders(ResponseInterface $response)
    {
        $headerNames = array_keys($response->getHeaders());
        $metaType = $this->objectMetaType();

        return array_filter($headerNames, function ($header) use ($metaType) {
            return strpos($header, 'X-'.$metaType.'-Meta') !== false;
        });
    }
690037
protected function extractResponseHeadersAndBody(string $response) {
        $parts = explode("\r\n\r\n", $response);
        $raw_body = array_pop($parts);
        $raw_headers = implode("\r\n\r\n", $parts);

        return [trim($raw_headers), trim($raw_body)];
    }
1357327
protected function getReferences($response, $type)
    {
        if ($type === 'refund') {
            $response = $response['refund'];
        }

        $id = Arr::get($response, 'id');

        return [$id, $this->getAuthorization($response)];
    }
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;
    }
120892
public function getChildren($id)
    {
        $location = $this
            ->locationRepository
            ->findOneBy([
                'id' => $id,
            ]);

        if (empty($location)) {
            throw new EntityNotFoundException();
        }

        return $this->formatOutputLocationArray(
            $location->getChildren()
        );
    }
507223
public static function decode(ResponseInterface $response): array
    {
        $contents = $response->getBody()->getContents();
        $decoded = json_decode($contents, true);
        $response->getBody()->rewind();

        if (json_last_error() !== JSON_ERROR_NONE || ! is_array($decoded)) {
            throw new JsonException(json_last_error_msg());
        }

        return $decoded;
    }
371579
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $discusses = [];
            foreach ($jsonData['result']['dnamelist'] as $discussData) {
                $discusses[] = EntityFactory::createEntity(Discuss::class, [
                     'id' => $discussData['did'],
                     'name' => $discussData['name'],
                ]);
            }

            return new EntityCollection($discusses);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
1131970
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $recentList = [];
            foreach ($jsonData['result'] as $recent) {
                $recentList[] = EntityFactory::createEntity(Recent::class, [
                    'type' => $recent['type'],
                    'uin' => $recent['uin'],
                ]);
            }

            return new EntityCollection($recentList);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
862809
public function entityNotFound(
        EntityRequestInterface $entityRequest,
        ServerRequestInterface $request,
        ResponseInterface $response
    ): ResponseInterface {
        $model = $entityRequest->getTableMap()->getPhpName();
        $pk    = $entityRequest->getPrimaryKey();

        return $this->render(
            $request,
            $response,
            "Entity Not Found",
            404,
            "{$model} #{$pk} not found"
        );
    }
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;
    }
3156
protected function parseResponse(Response $response)
    {
        $xml = new \DomDocument();
        $xml->loadXML($response->getBody());

        return XML2Array::createArray($xml->saveXML());
    }