protected extractTextValueForNodes ( array $textNodes ) : string | ||
$textNodes | array | Text XML nodes (" |
return | string | The value associated with the given text node(s) |
protected function extractTextValueForNodes($textNodes)
{
$textValue = '';
foreach ($textNodes as $nodeIndex => $textNode) {
if ($nodeIndex !== 0) {
// add a space between each "t" node
$textValue .= ' ';
}
$textNodeAsString = $textNode->__toString();
$shouldPreserveWhitespace = $this->shouldPreserveWhitespace($textNode);
$textValue .= $shouldPreserveWhitespace ? $textNodeAsString : trim($textNodeAsString);
}
return $textValue;
}