@param \Illuminate\Http\Response $response

@return $this
321656
protected function generateAndAttachLinkHeaders(Response $response, $limit = null)
    {
        $headers = $this->fetchLinkableNodes($response)
            ->flatten(1)
            ->map(function ($url) {
                return $this->buildLinkHeaderString($url);
            })
            ->filter()
            ->unique()
            ->take($limit)
            ->implode(',');

        if (!empty(trim($headers))) {
            $this->addLinkHeader($response, $headers);
        }

        return $this;
    }
175462
public function respond(ResponseInterface $response)
    {
        if (headers_sent()) {
            throw new HeadersAlreadySentException('Headers were already sent');
        }

        /** @var PsrResponseInterface $r */
        $r = $response;

        $status = sprintf('HTTP/%s %s %s', $r->getProtocolVersion(), $r->getStatusCode(), $r->getReasonPhrase());
        header($status, TRUE);

        foreach ($r->getHeaders() as $name => $values) {
            $header = sprintf('%s: %s', $name, $r->getHeaderLine($name));
            header($header, FALSE);
        }

        echo $r->getBody();
    }
61316
public function prepareForResponse(Response $response) {
		$response->setHeader('Content-Type: ' . $this->getContentType());

		if (!$this->isInitialized()) {
			$this->initialize();
		}
	}
300937
public function prepareForResponse(Response $response) {
		$response->setStatus($this->httpStatus);
		$response->setHeader('Content-Type: text/html; charset=' . N2N::CHARSET);
		$response->setHeader('Location: ' . $this->httpLocation);
	}
793516
public static function fromResponse(Response $response)
    {
        $header = $response->headers->get('Link');
        if (is_array($header)) {
            implode(',', $header);
        }

        return self::fromString($header);
    }
907508
public static function fromResponse(ResponseInterface $response) : SetCookies
    {
        return new static(array_map(function (string $setCookieString) : SetCookie {
            return SetCookie::fromSetCookieString($setCookieString);
        }, $response->getHeader(static::SET_COOKIE_HEADER)));
    }
969658
public function response($response, $context = null)
    {
        $responseMessage = $response->asResponseMessage($context);
        $this->responseMessage($responseMessage);
    }
1306643
public static function onRequest($request, $response) {
		$request = new Request($request);
		$request->setCookieHandler([$response, 'cookie']);
		$response = new Response($response);
		Container::getInstance()
			->get(Dispatcher::class)
			->handleRequest($request, $response);
	}
916281
public function prepareForResponse(\n2n\web\http\Response $response) {
		$response->setStatus($this->statusCode);
		foreach ($this->headers as $header) {
			$response->setHeader($header);
		}

		$response->setHttpCacheControl($this->httpCacheControl);

	}
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;
    }
961344
public static function create($response)
    {
        if (is_array($response)) {
            return new Response($response[0], $response[1]);
        } elseif (is_int($response)) {
            return new Response($response);
        } elseif (is_string($response)) {
            return new Response(200, $response);
        } elseif ($response instanceof Response) {
            return $response;
        }
        return new Response;
    }
530325
public function bind(Request $request = null, AbstractResponse $response = null)
    {
        // Keep references
        $this->request  = $request  ?: $this->request;
        $this->response = $response ?: $this->response;

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

        return $response;
    }
683651
protected function response(Response $response)
    {
        return $this->response->create(
            (string)$response->getContent(),
            $response->getStatusCode(),
            (array)$response->headers->all()
        );
    }
1341537
public function fetchCookies($request, $response)
    {
        foreach ($response->cookies($request) as $cookie) {
            $this->add($cookie);
        }
        return $this;
    }
413084
public function setResponse($response)
    {
        if (is_string($response) && class_exists($response)) {
            $response = new $response();
            if (!$response instanceof Zend_Amf_Response) {
                require_once 'Zend/Amf/Server/Exception.php';
                throw new Zend_Amf_Server_Exception('Invalid response class');
            }
        } elseif (!$response instanceof Zend_Amf_Response) {
            require_once 'Zend/Amf/Server/Exception.php';
            throw new Zend_Amf_Server_Exception('Invalid response object');
        }
        $this->_response = $response;
        return $this;
    }
1082690
public function set_response_name($name)
    {
        if (!empty($this->name)) {
            unset(self::$responses[$this->name]);
        }
        $this->name = $name;
        self::$responses[$this->name] = $this;

        return $this;
    }