protected function packCookies(Response $response, CookieQueue $queue): Response
    {
        if (empty($queue->getScheduled())) {
            return $response;
        }

        $cookies = $response->getHeader('Set-Cookie');

        foreach ($queue->getScheduled() as $cookie) {
            if (!$this->isProtected($cookie->getName()) || empty($cookie->getValue())) {
                $cookies[] = $cookie->createHeader();
                continue;
            }

            $cookies[] = $this->encodeCookie($cookie)->createHeader();
        }

        return $response->withHeader('Set-Cookie', $cookies);
    }
protected function packCookies(Response $response, CookieQueue $queue): Response
    {
        if (empty($queue->getScheduled())) {
            return $response;
        }

        $cookies = $response->getHeader('Set-Cookie');

        foreach ($queue->getScheduled() as $cookie) {
            if (!$this->isProtected($cookie->getName()) || empty($cookie->getValue())) {
                $cookies[] = $cookie->createHeader();
                continue;
            }

            $cookies[] = $this->encodeCookie($cookie)->createHeader();
        }

        return $response->withHeader('Set-Cookie', $cookies);
    }
protected function packCookies ( Response $ response , CookieQueue $ queue ) : Response { if ( empty ( $ queue -> getScheduled ( ) ) ) { return $ response ; } $ cookies = $ response -> getHeader ( 'Set-Cookie' ) ; foreach ( $ queue -> getScheduled ( ) as $ cookie ) { if ( ! $ this -> isProtected ( $ cookie -> getName ( ) ) || empty ( $ cookie -> getValue ( ) ) ) { $ cookies [ ] = $ cookie -> createHeader ( ) ; continue ; } $ cookies [ ] = $ this -> encodeCookie ( $ cookie ) -> createHeader ( ) ; } return $ response -> withHeader ( 'Set-Cookie' , $ cookies ) ; }
Pack outcoming cookies with encrypted value.

@param Response    $response
@param CookieQueue $queue

@return Response

@throws \Spiral\Encrypter\Exceptions\EncryptException
Pack outcoming cookies with encrypted value .