src/web/Response.php
/**
     * Sends the cookies to the client.
     */
Sends the cookies to the client.
Sends the cookies to the client .
protected function sendCookies()
    {
        if ( ! Application::$workerApp)
        {
            parent::sendCookies();
            return;
        }
        if ($this->getCookies() === null)
        {
            return;
        }
        $request = Yii::$app->getRequest();
        if ($request->enableCookieValidation)
        {
            if ($request->cookieValidationKey == '')
            {
                throw new InvalidConfigException(get_class($request) . '::cookieValidationKey must be configured with a secret key.');
            }
            $validationKey = $request->cookieValidationKey;
        }
        foreach ($this->getCookies() as $cookie)
        {
            $value = $cookie->value;
            if ($cookie->expire != 1 && isset($validationKey))
            {
                $value = Yii::$app->getSecurity()->hashData(serialize([$cookie->name, $value]), $validationKey);
            }
            $this->getServerResponse()->cookie($cookie->name, $value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly);
        }
    }
protected function sendCookies ( ) { if ( ! Application :: $ workerApp ) { parent :: sendCookies ( ) ; return ; } if ( $ this -> getCookies ( ) === null ) { return ; } $ request = Yii :: $ app -> getRequest ( ) ; if ( $ request -> enableCookieValidation ) { if ( $ request -> cookieValidationKey == '' ) { throw new InvalidConfigException ( get_class ( $ request ) . '::cookieValidationKey must be configured with a secret key.' ) ; } $ validationKey = $ request -> cookieValidationKey ; } foreach ( $ this -> getCookies ( ) as $ cookie ) { $ value = $ cookie -> value ; if ( $ cookie -> expire != 1 && isset ( $ validationKey ) ) { $ value = Yii :: $ app -> getSecurity ( ) -> hashData ( serialize ( [ $ cookie -> name , $ value ] ) , $ validationKey ) ; } $ this -> getServerResponse ( ) -> cookie ( $ cookie -> name , $ value , $ cookie -> expire , $ cookie -> path , $ cookie -> domain , $ cookie -> secure , $ cookie -> httpOnly ) ; } }
Sends the cookies to the client.
Sends the cookies to the client .