protected function encodeCookies(
        YiiResponse $response,
        Request $request,
        Security $security
    ) {
        if ($request->enableCookieValidation) {
            $validationKey = $request->cookieValidationKey;
        }

        foreach ($response->getCookies() as $cookie) {
            /** @var \yii\web\Cookie $cookie */
            $value = $cookie->value;
            if ($cookie->expire != 1 && isset($validationKey)) {
                $data = version_compare(Yii::getVersion(), '2.0.2', '>')
                    ? [$cookie->name, $cookie->value]
                    : $cookie->value;
                $value = $security->hashData(serialize($data), $validationKey);
            }
            $c = new Cookie(
                $cookie->name,
                $value,
                $cookie->expire,
                $cookie->path,
                $cookie->domain,
                $cookie->secure,
                $cookie->httpOnly
            );
            $this->getCookieJar()->set($c);
        }
    }
protected function encodeCookies(
        YiiResponse $response,
        Request $request,
        Security $security
    ) {
        if ($request->enableCookieValidation) {
            $validationKey = $request->cookieValidationKey;
        }

        foreach ($response->getCookies() as $cookie) {
            /** @var \yii\web\Cookie $cookie */
            $value = $cookie->value;
            if ($cookie->expire != 1 && isset($validationKey)) {
                $data = version_compare(Yii::getVersion(), '2.0.2', '>')
                    ? [$cookie->name, $cookie->value]
                    : $cookie->value;
                $value = $security->hashData(serialize($data), $validationKey);
            }
            $c = new Cookie(
                $cookie->name,
                $value,
                $cookie->expire,
                $cookie->path,
                $cookie->domain,
                $cookie->secure,
                $cookie->httpOnly
            );
            $this->getCookieJar()->set($c);
        }
    }
protected function encodeCookies ( YiiResponse $ response , Request $ request , Security $ security ) { if ( $ request -> enableCookieValidation ) { $ validationKey = $ request -> cookieValidationKey ; } foreach ( $ response -> getCookies ( ) as $ cookie ) { /** @var \yii\web\Cookie $cookie */ $ value = $ cookie -> value ; if ( $ cookie -> expire != 1 && isset ( $ validationKey ) ) { $ data = version_compare ( Yii :: getVersion ( ) , '2.0.2' , '>' ) ? [ $ cookie -> name , $ cookie -> value ] : $ cookie -> value ; $ value = $ security -> hashData ( serialize ( $ data ) , $ validationKey ) ; } $ c = new Cookie ( $ cookie -> name , $ value , $ cookie -> expire , $ cookie -> path , $ cookie -> domain , $ cookie -> secure , $ cookie -> httpOnly ) ; $ this -> getCookieJar ( ) -> set ( $ c ) ; } }
Encodes the cookies and adds them to the headers.
@param \yii\web\Response $response
@throws \yii\base\InvalidConfigException
Encodes the cookies and adds them to the headers .