original_string: public function register(
          $doctype,
          $xml = true,
          $modules = array(),
          $tidy_modules = array(),
          $aliases = array(),
          $dtd_public = null,
          $dtd_system = null
      ) {
          if (!is_array($modules)) {
              $modules = array($modules);
          }
          if (!is_array($tidy_modules)) {
              $tidy_modules = array($tidy_modules);
          }
          if (!is_array($aliases)) {
              $aliases = array($aliases);
          }
          if (!is_object($doctype)) {
              $doctype = new HTMLPurifier_Doctype(
                  $doctype,
                  $xml,
                  $modules,
                  $tidy_modules,
                  $aliases,
                  $dtd_public,
                  $dtd_system
              );
          }
          $this->doctypes[$doctype->name] = $doctype;
          $name = $doctype->name;
          // hookup aliases
          foreach ($doctype->aliases as $alias) {
              if (isset($this->doctypes[$alias])) {
                  continue;
              }
              $this->aliases[$alias] = $name;
          }
          // remove old aliases
          if (isset($this->aliases[$name])) {
              unset($this->aliases[$name]);
          }
          return $doctype;
      }
code: public function register(
          $doctype,
          $xml = true,
          $modules = array(),
          $tidy_modules = array(),
          $aliases = array(),
          $dtd_public = null,
          $dtd_system = null
      ) {
          if (!is_array($modules)) {
              $modules = array($modules);
          }
          if (!is_array($tidy_modules)) {
              $tidy_modules = array($tidy_modules);
          }
          if (!is_array($aliases)) {
              $aliases = array($aliases);
          }
          if (!is_object($doctype)) {
              $doctype = new HTMLPurifier_Doctype(
                  $doctype,
                  $xml,
                  $modules,
                  $tidy_modules,
                  $aliases,
                  $dtd_public,
                  $dtd_system
              );
          }
          $this->doctypes[$doctype->name] = $doctype;
          $name = $doctype->name;
          // hookup aliases
          foreach ($doctype->aliases as $alias) {
              if (isset($this->doctypes[$alias])) {
                  continue;
              }
              $this->aliases[$alias] = $name;
          }
          // remove old aliases
          if (isset($this->aliases[$name])) {
              unset($this->aliases[$name]);
          }
          return $doctype;
      }
code_tokens: public function register ( $ doctype , $ xml = true , $ modules = array ( ) , $ tidy_modules = array ( ) , $ aliases = array ( ) , $ dtd_public = null , $ dtd_system = null ) { if ( ! is_array ( $ modules ) ) { $ modules = array ( $ modules ) ; } if ( ! is_array ( $ tidy_modules ) ) { $ tidy_modules = array ( $ tidy_modules ) ; } if ( ! is_array ( $ aliases ) ) { $ aliases = array ( $ aliases ) ; } if ( ! is_object ( $ doctype ) ) { $ doctype = new HTMLPurifier_Doctype ( $ doctype , $ xml , $ modules , $ tidy_modules , $ aliases , $ dtd_public , $ dtd_system ) ; } $ this -> doctypes [ $ doctype -> name ] = $ doctype ; $ name = $ doctype -> name ; // hookup aliases foreach ( $ doctype -> aliases as $ alias ) { if ( isset ( $ this -> doctypes [ $ alias ] ) ) { continue ; } $ this -> aliases [ $ alias ] = $ name ; } // remove old aliases if ( isset ( $ this -> aliases [ $ name ] ) ) { unset ( $ this -> aliases [ $ name ] ) ; } return $ doctype ; }
docstring: Registers a doctype to the registry
  @note Accepts a fully-formed doctype object, or the
  parameters for constructing a doctype object
  @param string $doctype Name of doctype or literal doctype object
  @param bool $xml
  @param array $modules Modules doctype will load
  @param array $tidy_modules Modules doctype will load for certain modes
  @param array $aliases Alias names for doctype
  @param string $dtd_public
  @param string $dtd_system
  @return HTMLPurifier_Doctype Editable registered doctype
docstring_tokens: Registers a doctype to the registry