code: protected function isValidUsername($name)
      {
          if (!is_string($name)
              || !$this->storage->checkValidName($name)
              || strlen($name) < $this->config["registration"]["nameLenMin"]
              || strlen($name) > $this->config["registration"]["nameLenMax"]
          ) {
              return false;
          }
          return true;
      }
docs: Checks username validity
  
  @param string $name Username to be checked
  @return boolean true if the username is valid, false otherwise