@param \Riak\Client\Core\Message\DataType\Response $response

@return \Riak\Client\Core\Query\Crdt\RiakMap
550867
public function convertMap(Response $response)
    {
        $value = $response->value;
        $map   = new RiakMap($value);

        return $map;
    }
266561
public function import(Response $response)
    {
        $this->clear();
        foreach ($response->toArray() as $key => $value) {
            $this->offsetSet($key, $value);
        }

        return $this;
    }
262770
protected function getResourceForResponse($response)
    {
        $api_response = new \GoCardlessPro\Core\ApiResponse($response);
        $unenveloped_body = $this->getUnenvelopedBody($api_response->body);

        if(is_array($unenveloped_body)) {
            return new ListResponse($unenveloped_body, $this->resource_class, $api_response);
        } else {
            $rclass = $this->resource_class;
            return new $rclass($unenveloped_body, $api_response);
        }
    }
1163520
protected function createResponse(Response $response)
    {
        $contentType = $response->getHeader('Content-Type');

        if (!$contentType) {
            $contentType = 'text/html';
        }

        if (strpos($contentType, 'charset=') === false) {
            $body = $response->getBody(true);
            if (preg_match('/\<meta[^\>]+charset *= *["\']?([a-zA-Z\-0-9]+)/i', $body, $matches)) {
                $contentType .= ';charset=' . $matches[1];
            }
            $response->setHeader('Content-Type', $contentType);
        }

        $headers = $response->getHeaders();
        $status = $response->getStatusCode();
        if ($status < 300 || $status >= 400) {
            $matches = [];

            $matchesMeta = preg_match(
                '/\<meta[^\>]+http-equiv="refresh" content="\s*(\d*)\s*;\s*url=(.*?)"/i',
                $response->getBody(true),
                $matches
            );

            if (!$matchesMeta) {
                // match by header
                preg_match(
                    '/^\s*(\d*)\s*;\s*url=(.*)/i',
                    (string)$response->getHeader('Refresh'),
                    $matches
                );
            }

            if ((!empty($matches)) && (empty($matches[1]) || $matches[1] < $this->refreshMaxInterval)) {
                $uri = $this->getAbsoluteUri($matches[2]);
                $partsUri = parse_url($uri);
                $partsCur = parse_url($this->getHistory()->current()->getUri());
                foreach ($partsCur as $key => $part) {
                    if ($key === 'fragment') {
                        continue;
                    }
                    if (!isset($partsUri[$key]) || $partsUri[$key] !== $part) {
                        $status = 302;
                        $headers['Location'] = $matchesMeta ? htmlspecialchars_decode($uri) : $uri;
                        break;
                    }
                }
            }
        }

        return new BrowserKitResponse($response->getBody(), $status, $headers);
    }
1055374
public function transform($response)
    {
        $binding = $this->getBinding($response);

        return $this->adapter->transform($response, $binding->resolveTransformer(), $binding, $this->getRequest());
    }
124569
protected function buildCacheDirectives($response)
    {
        $cacheControlHeader = null;
        if ($response->hasHeader('cache-control')) {
            $cacheControlHeader = $this->parseHeader($response->getHeader('cache-control'));
            $cacheControlHeader = current($cacheControlHeader);
            $cacheControlHeader = (isset($cacheControlHeader['max-age'])?$cacheControlHeader['max-age']:null);
        }

        $expiresHeader = null;
        if ($response->hasHeader('expires')){
            $expiresHeader = implode(' ',array_column($this->parseHeader($response->getHeader('expires')),0));
        }

        return array_filter([
            'maxAge'=>$cacheControlHeader,
            'expires'=>$expiresHeader,
        ]);
    }
192545
private function persistResponse(Response $response)
    {
        $headers = $response->headers->all();
        $headers['X-Status'] = [$response->getStatusCode()];

        return $headers;
    }
865313
public function mapResponse($success, $response)
    {
        $rawResponse = $response;

        unset($rawResponse['isRedirect']);

        if (array_key_exists('INVALID', $response) || array_key_exists('VERIFIED', $response)) {
            $success = array_key_exists('VERIFIED', $response);

            return (new Response())->setRaw($rawResponse)->map([
                'isRedirect'      => false,
                'success'         => $success ? true : false,
                'reference'       => $success ? Arr::get($response, 'invoice') : false,
                'message'         => $success ? 'VERIFIED' : 'INVALID',
                'test'            => $this->config['test'],
                'authorization'   => $success ? Arr::get($response, 'txn_id') : '',
                'status'          => $success ? $this->getPaymentStatus($response) : new Status('failed'),
                'errorCode'       => null,
                'type'            => $success ? Arr::get($response, 'txn_type') : null,
            ]);
        }

        return (new Response())->setRaw($rawResponse)->map([
            'isRedirect'      => $response['isRedirect'],
            'success'         => $response['isRedirect'] ? false : $success,
            'reference'       => $success ? $this->getReference($response, $response['isRedirect']) : false,
            'message'         => $success ? Arr::get($response, 'ACK', 'Transaction approved') : $response['L_LONGMESSAGE0'],
            'test'            => $this->config['test'],
            'authorization'   => $this->getAuthorization($response, $success, $response['isRedirect']),
            'status'          => $success ? $this->getStatus($response, $response['isRedirect']) : new Status('failed'),
            'errorCode'       => $success ? null : $this->getErrorCode($response['L_ERRORCODE0']),
            'type'            => null,
        ]);
    }
177678
protected function parseResponse(Response $response)
    {
        $contentType = explode(';', $response->getHeader('content-type'))[0];

        switch ($contentType) {
            case 'application/json':
            case 'application/vnd.api+json':
                return $response->json();

            case 'application/xml':
                return $response->xml();
        }

        throw new RuntimeException("Unsupported returned content-type [$contentType]");
    }
271999
public function response($response)
    {
        if (!($response instanceof ResponseInterface)) {
            if (is_array($response) || $response instanceof \stdClass || $response instanceof \JsonSerializable) {
                $response = Response::make(json_encode($response));
                $response = $response->withHeader('Content-Type', 'application/json');
            } elseif (is_object($response) && method_exists($response, 'render')) {
                $response = Response::make($realResponse->render());
            } elseif (is_string($response) || is_numeric($response) || is_bool($response)) {
                $response = Response::make($response);
            } else {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid response "%s"; must be an string or object has render method',
                    gettype($response)
                ));
            }
        }
        return $response;
    }
818500
protected function setResponseHeaders(Response $response)
    {
        $response->headers->set('Access-Control-Allow-Origin', '*');
        $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');

        return $response;
    }
542236
public function buildData(ResponseInterface $response)
    {
        $data = new \stdClass();
        $data->apiVersion = $response->getApiVersion()->getValue();
        $data->method = $response->getHttpMethod()->getValue();

        $data->params = new \stdClass();
        /** @var Crak\Component\RestNormalizer\ParameterInterface $parameter */
        foreach ($response->getParameters() as $parameter) {
            $values = $parameter->getValues();
            $nbValues = count($values);

            $plainValues = null;
            if ($nbValues === 1) {
                $plainValues = $values->first()->getValue();
            } else if ($nbValues > 1) {
                foreach ($values as $value) {
                    $plainValues[] = $value->getValue();
                }
            }

            $data->params->{$parameter->getId()->getValue()} = $plainValues;
        }

        return $data;
    }
1133182
public function behave(Response $response)
    {
        return new Response(
            json_decode($response->content(), true),
            $response->contentType(),
            $response->error(),
            $response->errorCode(),
            $response->headerLines(),
            $response->statusCode()
        );
    }
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;
    }
1111566
public function persist(Response $response)
    {
        $trackingParameters = $this->trackingParameters->all();

        foreach ($trackingParameters as $trackingParameter => $value) {
            if (
                (null !== $value)
                && (true === in_array($trackingParameter, $this->cookiesToSave))
            ) {
                $response->headers->setCookie(new Cookie(
                    $trackingParameter,
                    $value,
                    new \DateTime('+1 year'),
                    '/',
                    null,
                    false,
                    false
                ));
            }
        }

        return $response;
    }
353404
public static function parseResponse(Response $response)
    {
        $jsonData = \GuzzleHttp\json_decode($response->getBody(), true);
        if ($jsonData && 0 == $jsonData['retcode']) {
            $profileData = $jsonData['result'];
            //注意获取好友详情接口并不返回account和lnick
            return EntityFactory::createEntity(Profile::class, [
                'account' => isset($profileData['account']) ? $profileData['account'] : null,
                'lnick' => isset($profileData['lnick']) ? $profileData['lnick'] : null,
                'face' => $profileData['face'],
                'birthday' => Birthday::createFromArray($profileData['birthday']),
                'occupation' => $profileData['occupation'],
                'phone' => $profileData['phone'],
                'allow' => $profileData['allow'],
                'college' => $profileData['college'],
                'uin' => $profileData['uin'],
                'constel' => $profileData['constel'],
                'blood' => $profileData['blood'],
                'homepage' => $profileData['homepage'],
                'stat' => isset($profileData['stat']) ? $profileData['stat'] : null,
                'vipInfo' => $profileData['vip_info'],
                'country' => $profileData['country'],
                'city' => $profileData['city'],
                'personal' => $profileData['personal'],
                'nick' => $profileData['nick'],
                'shengXiao' => $profileData['shengxiao'],
                'email' => $profileData['email'],
                'province' => $profileData['province'],
                'gender' => $profileData['gender'],
                'mobile' => $profileData['mobile'],
            ]);
        }
        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);
    }