code: public function assertUsername($username, $config)
      {
          if (!is_string($username)) {
              throw new ConfigurationException("Username $username must be a string.");
          }
          $len = strlen($username);
          $minLen=$config["registration"]["nameLenMin"];
          $maxLen=$config["registration"]["nameLenMax"];
          if ($len < $minLen || $len > $maxLen) {
              throw new ConfigurationException(
                  sprintf("Length of a username $username must be between %d-%d characters.", $minLen, $maxLen)
              );
          }
          if (!$this->checkValidNameFormat($username)) {
              throw new ConfigurationException("Username $username contains invalid character/s.");
          }
      }
docs: Asserts a valid username format
  
  @param string $username Username being checked
  @param array $config The configuration array
  @throws ConfigurationException On a failed assertation