framework/web/Request.php
protected function createCsrfCookie($token)
    {
        $options = $this->csrfCookie;
        return Yii::createObject(array_merge($options, [
            'class' => 'yii\web\Cookie',
            'name' => $this->csrfParam,
            'value' => $token,
        ]));
    }
protected function createCsrfCookie($token)
    {
        $options = $this->csrfCookie;
        return Yii::createObject(array_merge($options, [
            'class' => 'yii\web\Cookie',
            'name' => $this->csrfParam,
            'value' => $token,
        ]));
    }
Creates a cookie with a randomly generated CSRF token.
Initial values specified in [[csrfCookie]] will be applied to the generated cookie.
@param string $token the CSRF token
@return Cookie the generated cookie
@see enableCsrfValidation