private function encryptAndRenderCookies($resCookies)
    {
        $renderable = [];

        foreach ($resCookies as $cookie) {
            if (is_string($cookie)) {
                $cookie = SetCookie::fromSetCookieString($cookie);
            }

            if ($cookie instanceof SetCookie) {
                $val = $cookie->getValue();
                if ($val instanceof OpaqueProperty) {
                    $val = $val->getValue();
                }

                if (!in_array($cookie->getName(), $this->unencryptedCookies)) {
                    $val = $this->encryption->encrypt($val);
                }

                $renderable[$cookie->getName()] = (string) $cookie->withValue($val);
            }
        }

        return $renderable;
    }
private function encryptAndRenderCookies($resCookies)
    {
        $renderable = [];

        foreach ($resCookies as $cookie) {
            if (is_string($cookie)) {
                $cookie = SetCookie::fromSetCookieString($cookie);
            }

            if ($cookie instanceof SetCookie) {
                $val = $cookie->getValue();
                if ($val instanceof OpaqueProperty) {
                    $val = $val->getValue();
                }

                if (!in_array($cookie->getName(), $this->unencryptedCookies)) {
                    $val = $this->encryption->encrypt($val);
                }

                $renderable[$cookie->getName()] = (string) $cookie->withValue($val);
            }
        }

        return $renderable;
    }
private function encryptAndRenderCookies ( $ resCookies ) { $ renderable = [ ] ; foreach ( $ resCookies as $ cookie ) { if ( is_string ( $ cookie ) ) { $ cookie = SetCookie :: fromSetCookieString ( $ cookie ) ; } if ( $ cookie instanceof SetCookie ) { $ val = $ cookie -> getValue ( ) ; if ( $ val instanceof OpaqueProperty ) { $ val = $ val -> getValue ( ) ; } if ( ! in_array ( $ cookie -> getName ( ) , $ this -> unencryptedCookies ) ) { $ val = $ this -> encryption -> encrypt ( $ val ) ; } $ renderable [ $ cookie -> getName ( ) ] = ( string ) $ cookie -> withValue ( $ val ) ; } } return $ renderable ; }
Parse all cookies set on the response

- If string - leave alone (this is expected to be a fully rendered cookie string with expiry, etc)
- If instance of "SetCookie" - stringify
- If instance of "SetCookie" and OpaqueProperty - stringify

Cookies that are "SetCookie" will be encrypted if possible, or not if configured to not encrypt.

Cookies will be automatically deduped.

@param SetCookie[]|string[] $resCookies

@return string[]
Parse all cookies set on the response