Skip to content

Commit 201f756

Browse files
cs fixes
1 parent 197a375 commit 201f756

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,11 @@ public static function addHtml($element, $html, $fullHTML = false, $preserveWhit
9696
$validXml = self::convertHtmlToXml($html);
9797
}
9898

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');
105104

106105
static::parseNode($node->item(0), $element);
107106
if (\PHP_VERSION_ID < 80000) {
@@ -1322,6 +1321,11 @@ private static function convertRgb(string $rgb): string
13221321
return trim($rgb, '# ');
13231322
}
13241323

1324+
/**
1325+
* @param string $xml
1326+
*
1327+
* @return bool
1328+
*/
13251329
private static function isRubyCode(string $xml): bool
13261330
{
13271331
$pattern = '/<ruby\b([^>]*)>(.*?)<\/ruby>/is';
@@ -1330,9 +1334,10 @@ private static function isRubyCode(string $xml): bool
13301334
}
13311335

13321336
/**
1333-
* Converts HTML to well-formed XML
1337+
* Converts HTML to well-formed XML.
13341338
*
13351339
* @param string $html The HTML content to convert
1340+
*
13361341
* @return string The well-formed XML
13371342
* @throws Exception If conversion fails
13381343
*/

0 commit comments

Comments
 (0)