Create a Multi-Response Object.

@param Response $response

@return \DMS\Service\Meetup\Response\MultiResultResponse
542241
protected function createMultiResultResponse($response)
    {
        $response = new MultiResultResponse($response->getStatusCode(), $response->getHeaders(), $response->getBody());

        return $response;
    }
1002079
protected function createPsr7Response(Response $response)
    {
        return new PsrResponse(
            $response->getStatusCode(),
            $response->headers->all(),
            $response->getContent(),
            $response->getProtocolVersion()
        );
    }
779336
protected function respond($response)
    {
        if (Arr::get($response, 'object') === 'list') {
            if (!empty($response['data'])) {
                foreach ($response['data'] as $responseItem) {
                    $success = Arr::get($responseItem, 'object', 'error') !== 'error';

                    $responses[] = $this->mapResponse($success, $responseItem);
                }

                return $responses;
            } else {
                $response = $response['data'];
            }
        }

        $success = Arr::get($response, 'object', 'error') !== 'error';

        return $this->mapResponse($success, $response);
    }
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;
    }
879326
protected function configureResponse(ResponseInterface $Response){
        $Response->setRequest($this->Request);
        $Response->extract();
        return $Response;
    }
192545
private function persistResponse(Response $response)
    {
        $headers = $response->headers->all();
        $headers['X-Status'] = [$response->getStatusCode()];

        return $headers;
    }
870282
private function decorateResponse(Response $response)
    {
        if ($response instanceof Http\Response) {
            return $response;
        }

        return new Http\Response($response);
    }
187222
protected function respond($response)
    {
        $success = Arr::get($response, 'success');

        return $this->mapResponse($success, $response);
    }
497029
protected function encrypt(Response $response)
    {
        foreach ($response->headers->getCookies() as $cookie) {
            if ($this->isDisabled($cookie->getName())) {
                continue;
            }

            $response->headers->setCookie($this->duplicate(
                $cookie, $this->encrypter->encrypt($cookie->getValue(), static::serialized($cookie->getName()))
            ));
        }

        return $response;
    }
231674
protected function buildJsonpResponse(Response $response) {
		$content     = (string)$response->getBody();
		$contentType = $response->getHeaderLine('Content-Type');

		if (strpos($contentType, 'application/json') === false) {
			$content = '"' . $content . '"';
		}

		$callback = "{$this->callbackName}({$content});";

		$newResponse = new Response(200);
		$newResponse->getBody()->write($callback);

		return $newResponse->withHeader('Content-Type', 'application/javascript');
	}
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;
    }
255125
protected function mapResponse($success, array $response)
    {
        return (new Response())->setRaw($response)->map([
            'success' => $success,
            'message' => $success ? 'Message sent' : $response['message'],
        ]);
    }
286670
protected function populate(stdClass $response)
    {
        $multiorders = clone $this;

        $multiorders->data->id = $response->id;
        $multiorders->data->ownId = $response->ownId;
        $multiorders->data->status = $response->status;
        $multiorders->data->amount = new stdClass();
        $multiorders->data->amount->total = $response->amount->total;
        $multiorders->data->amount->currency = $response->amount->currency;
        $multiorders->data->orders = [];

        foreach ($response->orders as $responseOrder) {
            $order = new Orders($multiorders->moip);
            $order->populate($responseOrder);

            $multiorders->data->orders[] = $order;
        }

        $multiorders->data->createdAt = $response->createdAt;
        $multiorders->data->updatedAt = $response->updatedAt;
        $multiorders->data->_links = $response->_links;

        return $multiorders;
    }
72308
public function processResponse(\Amp\Artax\Response $response) {
        $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this);

        return $instance;
    }
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);
    }
1137806
protected function filterResponse(Response $response)
    {
        $event = new FilterResponseEvent($this->app, $response);
        $this->event_dispatcher->dispatch(DietcubeEvents::FILTER_RESPONSE, $event);

        return $this->finishRequest($event->getResponse());
    }
50690
public function handleResponse($response)
    {
        // recursion for batch
        if (is_array($response)) {
            $response_arr = array();
            foreach ($response as $res) {
                $response_arr[$res->id] = $this->handleResponse($res);
            }
            return $response_arr;
        }

        // return error response
        if (property_exists($response, 'error')) {
            return new Response(null, $response->id, $response->error->code, $response->error->message);
        }

        // return successful response
        return new Response($response->result, $response->id);
    }