/** * * @param $node * @return string */ public static function nodeToString(Node $node) { $string = ''; if ($node instanceof Node) { if ($node instanceof TextNode) { $string .= $node->getText() . " "; } elseif ($node instanceof PropertyNode || $node instanceof TemplateNode || $node instanceof LinkNode) { $children = $node->getChildren(); foreach ($children as $childNode) { $string .= self::nodeToString($childNode); } } return $string; } else { throw new DataParserException('Wrong paramter.'); } }
/** * * @param $node * @return string */ public static function nodeToString(Node $node) { $string = ''; if ($node instanceof TextNode) { $string .= $node->getText() . " "; } elseif ($node instanceof PropertyNode || $node instanceof TemplateNode || $node instanceof LinkNode) { $children = $node->getChildren(); foreach ($children as $childNode) { $string .= self::nodeToString($childNode); } } return $string; }