예제 #1
0
 /**
  * Authenticates anonymously the current user.
  *
  * @return WiseChatUser
  * @throws Exception
  */
 public function authenticateAnonymously()
 {
     if ($this->isAuthenticated()) {
         throw new Exception('Unsupported operation');
     }
     // generate new suffix for anonymous username:
     $userNameSuffix = $this->options->getUserNameSuffix() + 1;
     $this->options->setUserNameSuffix($userNameSuffix);
     $userName = $this->options->getOption('user_name_prefix', 'Anonymous') . $userNameSuffix;
     return $this->createUserAndSave($userName);
 }