Add the session cookie to the application response.

@param  \Symfony\Component\HttpFoundation\Response  $response
@param  \Illuminate\Session\SessionInterface  $session
@return void
2230
protected function addCookieToResponse(Response $response, SessionInterface $session)
	{
		if ($this->usingCookieSessions())
		{
			$this->manager->driver()->save();
		}

		if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig()))
		{
			$response->headers->setCookie(new Cookie(
				$session->getName(), $session->getId(), $this->getCookieExpirationDate(),
				$config['path'], $config['domain'], array_get($config, 'secure', false)
			));
		}
	}
809869
public function setSessionId(string $sessionId): void
    {
        if (empty($sessionId)) {
            throw new RuntimeException('CSRF middleware failed. SessionId not found!');
        }

        $this->sessionId = $sessionId;
    }
260273
private function sessionHandshake(Request $request, Response $response)
    {
        $session = $this->createSession($request, $response);
        if (null !== $session) {
            $this->injector->setSession(
                    $request->attachSession($session),
                    Session::class
            );
        }
    }
67382
public function processResponse(ResponseInterface $response)
    {
        if (!$response instanceof Response
            || !$this->getRequest()
        ) {
            return;
        }

        $response = $this->handleResponse($response);
        $this->renderResponse($response);
        $this->terminateApp();
    }
479386
protected function addCookieToResponse( Response $response, SessionInterface $session )
	{
		if ( $this->usingHandler( CookieSessionHandler::class ) )
			$this->driver()->save();

		if ( $this->sessionIsPersistent() )
			$response->headers->setCookie( new Cookie( $session->getName(), $session->getId(), $this->getCookieExpirationDate(), Config::get( $this->configPrefix . '.path' ), Config::get( $this->configPrefix . '.domain' ), Config::get( $this->configPrefix . '.secure', false ), Config::get( $this->configPrefix . '.http_only', true ) ) );
	}
567279
protected function addCookieToResponse(Response $response, Session $session)
    {
        if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
            $response->headers->setCookie(new Cookie(
                $session->getName(), $session->getId(), $this->getCookieExpirationDate(),
                $config['path'], $config['domain'], $config['secure'] ?? false,
                $config['http_only'] ?? true, false, $config['same_site'] ?? null
            ));
        }
    }
438690
private function makeSession($response)
    {
        $this->session()->setData([
            'pagseguro_payment' => ['payment_link' => $response->getPaymentLink(),
                'payment_type'  => strtolower(Boleto::class),
                'order_id'      => $this->lastRealOrderId(),
            ]
        ]);
    }
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;
    }
1159223
protected function addCookieToResponse($request, $response)
    {
        $config = config('session');

        $response->headers->setCookie(
            new Cookie(
                'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
                $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
            )
        );

        return $response;
    }
955773
protected function initSession($response = null)
    {
        if (!$response) {
            if ($session_config = Lb::app()->getSessionConfig()) {
                if (isset($session_config['type'])) {
                    $route_info = Lb::app()->getRouteInfo();
                    $controller = $route_info['controller'];
                    $action = $route_info['action'];
                    if (empty($session_config['filter'][$controller][$action])) {
                        Session::setSession($session_config['type']);
                    }
                }
            }
        }
        $response ? $response->startSession() : ResponseKit::startSession();
    }
735100
public function sendResponse(ResponseInterface $response) : void
    {
        if (!headers_sent()) {
            $this->sendStatusLine($response);
            $this->sendHeaders($response);
        }
        $this->eventDispatcher->dispatch(new EventAfterAppReponseHeadersSending($response));
        $this->sendBody($response);
    }
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();
    }
1235072
public function bind($response) {
		$this->_response = $response;
		$this->_response->headers += $this->_headers;

		foreach ($this->_queue as $message) {
			$this->_write($message);
		}
	}
687363
public function resolve(ResponseInterface $response): void
    {
        if (Promise::PENDING !== $this->state) {
            return;
        }

        $this->value = $response;
        $this->state = Promise::FULFILLED;

        foreach ($this->onFulfilledCallbacks as $onFulfilledCallback) {
            $onFulfilledCallback($response);
        }
    }
414952
public function init($request, $response)
    {
        $this->request = $request;
        $this->response = $response;

        $this->c()->set('request', $request);
        $this->c()->set('response', $response);
    }
1098941
public static void storeSessionDataInCookie(String key, String value, ServletResponse response)
	{
		Cookie cookie = new Cookie(key, value);
		cookie.setPath("/");
		cookie.setMaxAge(-1);//expire when browser closes
		((HttpServletResponse) response).addCookie(cookie);
	}
635892
protected function display($response) {
        // TODO get rid of backwards compat here.
        if($response->alteredSession()) {
            $this->request->setAllSession($response->getAllSession());
        }
        if($response->alteredCookies()) {
            $this->request->setAllCookies($response->getAllCookies());
        }
        $this->request->commitSessionAndCookies();
        if(is_object($response)) {
            $response->compile();
        } else {
            echo $response;
        }
    }