@param Response $response

@return \Generator

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

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

        return $headers;
    }
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;
        }
    }
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);
    }
1107548
private function transformGenericSearchToData($response)
    {
        if ($response instanceof ActiveQueryInterface) {
            return $response->asArray(true)->all();
        } elseif ($response instanceof QueryInterface) {
            return $response->all();
        }
        
        return $response;
    }
773806
protected function getResponseBody($response)
    {
        //Response must be string
        $body = $response;

        if ($response instanceof ResponseInterface) {
            //Fetch the body
            $body = $response->getBody();
        }

        if ($body instanceof StreamInterface) {
            $body = $body->getContents();
        }

        return (string) $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;
    }
1333320
private function _buildResponse($response)
    {
        $sections = explode("\r\n\r\n", $response, 2);
        $body = isset($sections[1]) ? $sections[1] : NULL;
        $headers = array();
        $headerlines = explode("\n", $sections[0]);

        // process status
        list($http, $code, $message) = explode(' ', $headerlines[0], 3);

        // process headers
        foreach (array_slice($headerlines, 1) as $headerline) {
            $headers[] = HeaderField::fromString($headerline);
        }

        $response = new Response($code, $headers, $body);

        return $response;
    }
150374
protected function parseResponse($response)
    {
        synapse()->tags->each(function ($tag) use (&$response) {
            $class = "\\Axiom\\Rivescript\\Cortex\\Tags\\$tag";
            $tagClass = new $class();

            $response = $tagClass->parse($response, $this->input);
        });

        return $response;
    }
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);
    }
428368
public static function create($response)
    {
        Validate::isString($response, 'response');

        $wrapAccessTokenResult = new self();
        parse_str($response, $parsedResponse);

        $wrapAccessTokenResult->setAccessToken(
            Utilities::tryGetValue(
                $parsedResponse, Resources::WRAP_ACCESS_TOKEN
            )
        );

        $wrapAccessTokenResult->setExpiresIn(
            Utilities::tryGetValue(
                $parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN
            )
        );

        return $wrapAccessTokenResult;
    }
116187
private function resolveResponseArray(array $response)
    {
        if ($count = count($response)) {
            if ($count === 1) {
                $response = $response[0];
            }
        }
        $this->firing[] = $response;

        return $response;
    }
1358918
private function _parseResponse(Response $response)
    {
        switch ($this->_format) {
            case self::FORMAT_JSON:
                return json_decode($response, $this->_isJsonDecodeAssoc);
                break;
            default:
                return $response;
        }
    }
1071495
public static function fromString($response)
	{
		$code 	 = self::extractCode($response);
		$headers = self::extractHeaders($response);
		$body 	 = self::extractBody($response);
		$version = self::extractVersion($response);
		$message = self::extractMessage($response);
		
		# FIX FOR MULTIPLE HTTP RESPONSE CODE RETURNED BY SERVER 
		if ($code === 100 && count($headers) === 0 && self::extractCode($body)) {
			return self::fromString($body);
		}
		
		return new static($code, $headers, $body, $version, $message);
	}
468929
protected function getFromCache(Response $response) {
    return $this->getCache()->get($this->getCacheSection($response), $response->getCacheId());
  }
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);
    }
1006395
protected function getResponseData(Response $response)
    {
        if ($response instanceof JsonResponse) {
            /** @var $response JsonResponse */
            return $response->getData(true) ?: [];
        }

        $content = $response->getContent();

        return json_decode($content, true) ?: false;
    }