src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php
protected function withEncryptedCookies(ResponseInterface $response): ResponseInterface
    {
        //$cookiesManager = new CookiesManager();
        //$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie'));

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

        // remove all the cookies
        $response = $response->withoutHeader('Set-Cookie');

        //$header = [];
        foreach ($cookies as $name => $cookie) {
            if (! in_array($name, $this->bypassed)) {
                $cookie['value'] = $this->encrypt($cookie['value']);
            }

            //$cookiesManager->set($name, $value);
            // add again all the cookies (and some are now encrypted)
            $response = $response->withAddedHeader('Set-Cookie', CookiesManager::toHeader($name, $cookie));
        }

        return $response;
    }
protected function withEncryptedCookies(ResponseInterface $response): ResponseInterface
    {
        //$cookiesManager = new CookiesManager();
        //$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie'));

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

        // remove all the cookies
        $response = $response->withoutHeader('Set-Cookie');

        //$header = [];
        foreach ($cookies as $name => $cookie) {
            if (! in_array($name, $this->bypassed)) {
                $cookie['value'] = $this->encrypt($cookie['value']);
            }

            //$cookiesManager->set($name, $value);
            // add again all the cookies (and some are now encrypted)
            $response = $response->withAddedHeader('Set-Cookie', CookiesManager::toHeader($name, $cookie));
        }

        return $response;
    }
protected function withEncryptedCookies ( ResponseInterface $ response ) : ResponseInterface { //$cookiesManager = new CookiesManager(); //$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie')); $ cookies = CookiesManager :: parseSetCookieHeader ( $ response -> getHeader ( 'Set-Cookie' ) ) ; // remove all the cookies $ response = $ response -> withoutHeader ( 'Set-Cookie' ) ; //$header = []; foreach ( $ cookies as $ name => $ cookie ) { if ( ! in_array ( $ name , $ this -> bypassed ) ) { $ cookie [ 'value' ] = $ this -> encrypt ( $ cookie [ 'value' ] ) ; } //$cookiesManager->set($name, $value); // add again all the cookies (and some are now encrypted) $ response = $ response -> withAddedHeader ( 'Set-Cookie' , CookiesManager :: toHeader ( $ name , $ cookie ) ) ; } return $ response ; }
Encode cookies from a response's Set-Cookie header.

@param ResponseInterface $response The response to encode cookies in.

@return ResponseInterface Updated response with encoded cookies.
Encode cookies from a response s Set - Cookie header .