function logOut() { if ($this->usertype == session::USER_DOCTOR || $this->usertype == session::USER_REGULAR) { OnlineUser::destroy(['id' => $this->username]); } unset($_SESSION['username']); unset($_SESSION['usertype']); unset($this->username); unset($this->usertype); $this->loggedin = false; }