original_string: public static function htmlToDomDocument($html)
      {
          if (!$html) {
              $html = '';
          }
  
          // Transform multibyte entities which otherwise display incorrectly.
          $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
  
          // Internal errors enabled as HTML5 not fully supported.
          libxml_use_internal_errors(true);
  
          // Instantiate new DOMDocument object, and then load in UTF-8 HTML.
          $dom = new DOMDocument();
          $dom->encoding = 'UTF-8';
          $dom->loadHTML("<div>$html</div>");
  
          return $dom;
      }
code: public static function htmlToDomDocument($html)
      {
          if (!$html) {
              $html = '';
          }
  
          // Transform multibyte entities which otherwise display incorrectly.
          $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
  
          // Internal errors enabled as HTML5 not fully supported.
          libxml_use_internal_errors(true);
  
          // Instantiate new DOMDocument object, and then load in UTF-8 HTML.
          $dom = new DOMDocument();
          $dom->encoding = 'UTF-8';
          $dom->loadHTML("<div>$html</div>");
  
          return $dom;
      }
code_tokens: public static function htmlToDomDocument ( $ html ) { if ( ! $ html ) { $ html = '' ; } // Transform multibyte entities which otherwise display incorrectly. $ html = mb_convert_encoding ( $ html , 'HTML-ENTITIES' , 'UTF-8' ) ; // Internal errors enabled as HTML5 not fully supported. libxml_use_internal_errors ( true ) ; // Instantiate new DOMDocument object, and then load in UTF-8 HTML. $ dom = new DOMDocument ( ) ; $ dom -> encoding = 'UTF-8' ; $ dom -> loadHTML ( "<div>$html</div>" ) ; return $ dom ; }
docstring: Builds a DOMDocument object from a string containing HTML.
  @param string $html HTML to load
  @returns DOMDocument Returns a DOMDocument object.
docstring_tokens: Builds a DOMDocument object from a string containing HTML .