public function logout($destroySession = true) { $identity = $this->getIdentity(); if ($identity !== null) { $this->switchIdentity(null); $id = $identity->getId(); //$this->unsetIdentityCookie(); Application::info("User '{$id}' logged out.", __METHOD__); if ($destroySession) { Application::$app->getSession()->destroy(); } } return $this->getIsGuest(); }