示例#1
0
 /**
  * @param \simple_html_dom_node $node
  *
  * @return string
  */
 protected function getRelevantNodeText($node)
 {
     if (!$node->hasChildNodes()) {
         return $node->innertext();
     }
     $output = '';
     foreach ($node->nodes as $child) {
         /* @var $child \simple_html_dom_node */
         if (!$child->hasChildNodes()) {
             $output .= $child->outertext();
         } elseif (in_array($child->nodeName(), static::$listContentTags, true)) {
             $output .= sprintf('<%1$s>%2$s</%1$s>', $child->nodeName(), $this->getRelevantNodeText($child));
         }
     }
     return $output;
 }