original_string: protected function generateUsername()
      {
          $userNameField = Podium::getInstance()->userNameField;
          if ($userNameField !== null) {
              if (empty(Podium::getInstance()->user->identity->$userNameField)) {
                  throw new InvalidConfigException("Non-existing or empty '$userNameField' field!");
              }
              $username = Podium::getInstance()->user->identity->$userNameField;
          } else {
              $try = 0;
              do {
                  $username = 'user_' . time() . mt_rand(1000, 9999);
                  if ($try++ > 10) {
                      throw new Exception('Failed to generate unique username!');
                  }
              } while ((new Query)->from(static::tableName())->where(['username' => $username])->exists());
          }
          $this->username = $username;
      }
code: protected function generateUsername()
      {
          $userNameField = Podium::getInstance()->userNameField;
          if ($userNameField !== null) {
              if (empty(Podium::getInstance()->user->identity->$userNameField)) {
                  throw new InvalidConfigException("Non-existing or empty '$userNameField' field!");
              }
              $username = Podium::getInstance()->user->identity->$userNameField;
          } else {
              $try = 0;
              do {
                  $username = 'user_' . time() . mt_rand(1000, 9999);
                  if ($try++ > 10) {
                      throw new Exception('Failed to generate unique username!');
                  }
              } while ((new Query)->from(static::tableName())->where(['username' => $username])->exists());
          }
          $this->username = $username;
      }
code_tokens: protected function generateUsername ( ) { $ userNameField = Podium :: getInstance ( ) -> userNameField ; if ( $ userNameField !== null ) { if ( empty ( Podium :: getInstance ( ) -> user -> identity -> $ userNameField ) ) { throw new InvalidConfigException ( "Non-existing or empty '$userNameField' field!" ) ; } $ username = Podium :: getInstance ( ) -> user -> identity -> $ userNameField ; } else { $ try = 0 ; do { $ username = 'user_' . time ( ) . mt_rand ( 1000 , 9999 ) ; if ( $ try ++ > 10 ) { throw new Exception ( 'Failed to generate unique username!' ) ; } } while ( ( new Query ) -> from ( static :: tableName ( ) ) -> where ( [ 'username' => $ username ] ) -> exists ( ) ) ; } $ this -> username = $ username ; }
docstring: Generates username for inherited account.
  @throws Exception
  @since 0.7
docstring_tokens: Generates username for inherited account .