@@ -96,12 +96,11 @@ public static function addHtml($element, $html, $fullHTML = false, $preserveWhit
96
96
$ validXml = self ::convertHtmlToXml ($ html );
97
97
}
98
98
99
- $ xmlDom = new DOMDocument ();
100
- $ xmlDom ->preserveWhiteSpace = $ preserveWhiteSpace ;
101
- $ xmlDom ->loadXML ($ validXml );
102
-
103
- static ::$ xpath = new DOMXPath ($ xmlDom );
104
- $ node = $ xmlDom ->getElementsByTagName ('body ' );
99
+ $ dom = new DOMDocument ();
100
+ $ dom ->preserveWhiteSpace = $ preserveWhiteSpace ;
101
+ $ dom ->loadXML ($ validXml );
102
+ static ::$ xpath = new DOMXPath ($ dom );
103
+ $ node = $ dom ->getElementsByTagName ('body ' );
105
104
106
105
static ::parseNode ($ node ->item (0 ), $ element );
107
106
if (\PHP_VERSION_ID < 80000 ) {
@@ -1322,6 +1321,11 @@ private static function convertRgb(string $rgb): string
1322
1321
return trim ($ rgb , '# ' );
1323
1322
}
1324
1323
1324
+ /**
1325
+ * @param string $xml
1326
+ *
1327
+ * @return bool
1328
+ */
1325
1329
private static function isRubyCode (string $ xml ): bool
1326
1330
{
1327
1331
$ pattern = '/<ruby\b([^>]*)>(.*?)<\/ruby>/is ' ;
@@ -1330,9 +1334,10 @@ private static function isRubyCode(string $xml): bool
1330
1334
}
1331
1335
1332
1336
/**
1333
- * Converts HTML to well-formed XML
1337
+ * Converts HTML to well-formed XML.
1334
1338
*
1335
1339
* @param string $html The HTML content to convert
1340
+ *
1336
1341
* @return string The well-formed XML
1337
1342
* @throws Exception If conversion fails
1338
1343
*/
0 commit comments