/** * Logs out the current user * * @param int $userId */ public function logout($userId = 0) { if ($userId === 0) { $userId = $this->userModel->getUserId(); } $this->saveRememberMeToken($userId, ''); $this->sessionHandler->destroy(session_id()); $this->response->headers->setCookie($this->setRememberMeCookie($userId, '', -1 * self::REMEMBER_ME_COOKIE_LIFETIME)); }