original_string: protected function createTokenId()
      {
          $max = strlen($this->tokenChars) - 1;
          $len = strlen($this->tokenFormat);
  
          do {
              $out = '';
              for ($i = 0; $i < $len; $i++) {
                  if ('\\' == $this->tokenFormat[$i]) {
                      $i++;
                      $out .= $this->tokenFormat[$i];
                  } else {
                      $out .= $this->tokenChars[mt_rand(0, $max)];
                  }
              }
  
          } while ($this->db->fetchOne('SELECT gto_id_token FROM gems__tokens WHERE gto_id_token = ?', $out));
  
          return $out;
      }
code: protected function createTokenId()
      {
          $max = strlen($this->tokenChars) - 1;
          $len = strlen($this->tokenFormat);
  
          do {
              $out = '';
              for ($i = 0; $i < $len; $i++) {
                  if ('\\' == $this->tokenFormat[$i]) {
                      $i++;
                      $out .= $this->tokenFormat[$i];
                  } else {
                      $out .= $this->tokenChars[mt_rand(0, $max)];
                  }
              }
  
          } while ($this->db->fetchOne('SELECT gto_id_token FROM gems__tokens WHERE gto_id_token = ?', $out));
  
          return $out;
      }
code_tokens: protected function createTokenId ( ) { $ max = strlen ( $ this -> tokenChars ) - 1 ; $ len = strlen ( $ this -> tokenFormat ) ; do { $ out = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( '\\' == $ this -> tokenFormat [ $ i ] ) { $ i ++ ; $ out .= $ this -> tokenFormat [ $ i ] ; } else { $ out .= $ this -> tokenChars [ mt_rand ( 0 , $ max ) ] ; } } } while ( $ this -> db -> fetchOne ( 'SELECT gto_id_token FROM gems__tokens WHERE gto_id_token = ?' , $ out ) ) ; return $ out ; }
docstring: Generates a random token and checks for uniqueness
  
  @return string A non-existing token
docstring_tokens: Generates a random token and checks for uniqueness