languages) || !in_array($language, $this->languages, true)) { throw new NotFoundHttpException('Указан не поддерживаемый язык'); } $cookie = new Cookie([ 'name' => $this->localeCookieName, 'value' => $language, 'expire' => $this->cookieExpire ?: time() + 60 * 60 * 24 * 365, 'domain' => $this->cookieDomain ?: '', 'httpOnly' => true, 'secure' => SecureUrlManager::isHttpsEnabled() ]); Yii::$app->getResponse()->getCookies()->add($cookie); if ($this->callback instanceof \Closure) { return call_user_func_array($this->callback, [ $this, $language ]); } return Yii::$app->response->redirect(Yii::$app->request->referrer ?: Yii::$app->homeUrl); } }