@param Response $response

@return array|Collection
@throws EntityNotFoundException
7267
public function makeArray(Response $response)
    {
        if (!$response->getSuccess()) {
            if ($this->asCollection) {
                return new Collection([], new Meta());
            }

            return [];
        }

        $result = $this->getResultFromResponse($response);

        if ($this->asCollection) {
            $collection = new Collection($result, $response->getMeta());

            return $collection;
        }

        return $result;
    }
618209
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $markNames = (new Collection($jsonData['result']['gmarklist']))->combine('uin', 'markname')
                ->toArray();
            $groups = [];
            foreach ($jsonData['result']['gnamelist'] as $groupData) {
                $groupId = $groupData['gid'];
                $groupData['id'] = $groupData['gid'];
                $groupData['markName'] = isset($markNames[$groupId]) ? $markNames[$groupId] : '';
                $group = EntityFactory::createEntity(Group::class, $groupData);
                $groups[] = $group;
            }

            return new EntityCollection($groups);
        }
        throw new ResponseException($jsonData['retcode'], $response);
    }
107399
protected function jsonActionResponse(Response $response): ServiceResponse
    {
        // get the frontendData set by the Frontend plugin and remove unnecessary data
        $frontendData = $this->viewVars['frontendData'];
        unset($frontendData['Types']);
        $response = [
            'code' => 'success',
            'data' => [
                'frontendData' => $frontendData,
                'html' => $response->body(),
                'closeDialog' => $this->viewVars['closeDialog']
            ]
        ];

        return new ServiceResponse($response);
    }
958849
public function getResultFromResponse(Response $response)
    {
        $buckets = $response->getData()['aggregations']['variant']['buckets'];

        foreach ($buckets as $bucket) {

            $source = $bucket['value']['hits']['hits'][0]['_source'];

            $data = json_decode($source['scope'], true);
            $element = $data['data'][0];
            $included = $data['included'];

            $included = $this->getIncludedArray($included);
            $mapperClass = $this->getMapperClass($element['type']);

            if (is_null($mapperClass)) {
                throw new EntityNotFoundException("Entity mapper class for {$element['type']} was not found");
            }

            $element['attributes'] = array_merge($element['attributes'], $source);
            $result[] = $this->createObject($mapperClass, $element, $included);
        }

        return $result ?? [];
    }
1358918
private function _parseResponse(Response $response)
    {
        switch ($this->_format) {
            case self::FORMAT_JSON:
                return json_decode($response, $this->_isJsonDecodeAssoc);
                break;
            default:
                return $response;
        }
    }
468929
protected function getFromCache(Response $response) {
    return $this->getCache()->get($this->getCacheSection($response), $response->getCacheId());
  }
192545
private function persistResponse(Response $response)
    {
        $headers = $response->headers->all();
        $headers['X-Status'] = [$response->getStatusCode()];

        return $headers;
    }
912337
protected function _withCustomHeaders($response)
    {
        foreach ((array)$this->getConfig('headers') as $key => $value) {
            $response = $response->withHeader($key, $value);
        }

        return $response;
    }
702785
public function listAction(Request $request, Response $response, array $args)
    {
        $entities = $this->em->getRepository($this->entityClass)->findAll();

        $response->setContent($this->twig->render($this->views['list'], [
            'entities' => $entities
        ]));

        return $response;
    }
450710
private function transformResponse($response)
    {
        if (is_null($response)) {
            return;
        }

        if ($body = $response->getBody()) {
            $body = new Stream($body->getStream());
        } else {
            $body = null;
        }

        $transformed = new Response(
            $response->getStatusCode(),
            null,
            $response->getHeaders(),
            $body,
            $response->getProtocolVersion()
        );

        return $transformed;
    }
341515
private function unserializeResponse($response)
    {
        $result = unserialize($response);
        if ($response !== 'b:0;' && $result === false) {
            throw new \Exception(substr($response, 0, 5000));
        }

        return $result;
    }
588731
protected function shouldEagerLoad($response)
    {
        if ($response instanceof IlluminatePaginator) {
            $response = $response->getCollection();
        }

        return $response instanceof EloquentCollection && $this->eagerLoading;
    }
991517
private function processResponse(Response $response)
    {
        $response = $response->getBody()->getContents();
        $response = json_decode($response, true);

        return $response;
    }
494113
protected function getResponseBody(Response $response): \Generator
    {
        $data = '';
        $stream = $response->getBody();
        while ($stream->isReadable()) {
            $data .= yield $stream->read();
        }

        return $data;
    }
381943
protected function parseGetLanguagesResponse(Response $response)
    {
        $responseBody = $response->getBody();
        $responseData = json_decode($responseBody);
        $languages = [];
        foreach ($responseData as $language) {
            $translation = explode('-', $language);
            $from = $translation[0];
            $to = $translation[1];
            $languages[] = [$from,$to];
        }
        return $languages;
    }
908802
public function makeCollection(Array $response, $eloquentModel) {

		// Sanity Check
		if (!class_exists($eloquentModel)) return Collection::make($response);

		// Get IDs
		$ids = [];
		foreach ($response as $id => $object) {
			$ids[] = $id;
			$ids[] = self::getId($object);
		}

		// Return Collection
		return call_user_func_array($eloquentModel.'::whereIn', ['_id', $ids]);
	}
190232
protected function parseResponse(Response $response)
    {
        if ($response->getStatusCode() > 199 && $response->getStatusCode() < 299) {
            if ($body = json_decode($response->getBody()->getContents(), 1)) {
                return new Collection($body);
            }
        }

        return new Collection;
    }