Skip to content

Commit 17521e7

Browse files
committed
PHPCS fixes
1 parent 3c3eecd commit 17521e7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ private static function parseChildNodes($node, $element, $styles, $data)
177177
$cNodes = $node->childNodes;
178178
if (count($cNodes) > 0) {
179179
foreach ($cNodes as $cNode) {
180-
self::parseNode($cNode, $element, $styles, $data);
180+
if ($element instanceof AbstractContainer) {
181+
self::parseNode($cNode, $element, $styles, $data);
182+
}
181183
}
182184
}
183185
}
@@ -230,9 +232,11 @@ private static function parseText($node, $element, &$styles)
230232
{
231233
$styles['font'] = self::parseInlineStyle($node, $styles['font']);
232234

233-
if (is_callable(array($element, 'addText'))) {
235+
// Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case.
236+
// @todo Find better error checking for this one
237+
// if (method_exists($element, 'addText')) {
234238
$element->addText($node->nodeValue, $styles['font'], $styles['paragraph']);
235-
}
239+
// }
236240

237241
return null;
238242
}

0 commit comments

Comments
 (0)