From 17521e75939133191156e2bec2e70940e5ba1e16 Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 14:06:47 +0000 Subject: [PATCH] PHPCS fixes --- src/PhpWord/Shared/Html.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index ad2e285f..64bcab1e 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -177,7 +177,9 @@ class Html $cNodes = $node->childNodes; if (count($cNodes) > 0) { foreach ($cNodes as $cNode) { - self::parseNode($cNode, $element, $styles, $data); + if ($element instanceof AbstractContainer) { + self::parseNode($cNode, $element, $styles, $data); + } } } } @@ -230,9 +232,11 @@ class Html { $styles['font'] = self::parseInlineStyle($node, $styles['font']); - if (is_callable(array($element, 'addText'))) { + // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case. + // @todo Find better error checking for this one + // if (method_exists($element, 'addText')) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); - } + // } return null; }