original_string: private static function removeProceedingNodes($domNode, $topNode)
      {
          $nextNode = $domNode->nextSibling;
  
          if ($nextNode !== null) {
              self::removeProceedingNodes($nextNode, $topNode);
              $domNode->parentNode->removeChild($nextNode);
          } else {
              //scan upwards till we find a sibling
              $curNode = $domNode->parentNode;
              while ($curNode !== $topNode) {
                  if ($curNode->nextSibling !== null) {
                      $curNode = $curNode->nextSibling;
                      self::removeProceedingNodes($curNode, $topNode);
                      $curNode->parentNode->removeChild($curNode);
                      break;
                  }
                  $curNode = $curNode->parentNode;
              }
          }
      }
code: private static function removeProceedingNodes($domNode, $topNode)
      {
          $nextNode = $domNode->nextSibling;
  
          if ($nextNode !== null) {
              self::removeProceedingNodes($nextNode, $topNode);
              $domNode->parentNode->removeChild($nextNode);
          } else {
              //scan upwards till we find a sibling
              $curNode = $domNode->parentNode;
              while ($curNode !== $topNode) {
                  if ($curNode->nextSibling !== null) {
                      $curNode = $curNode->nextSibling;
                      self::removeProceedingNodes($curNode, $topNode);
                      $curNode->parentNode->removeChild($curNode);
                      break;
                  }
                  $curNode = $curNode->parentNode;
              }
          }
      }
code_tokens: private static function removeProceedingNodes ( $ domNode , $ topNode ) { $ nextNode = $ domNode -> nextSibling ; if ( $ nextNode !== null ) { self :: removeProceedingNodes ( $ nextNode , $ topNode ) ; $ domNode -> parentNode -> removeChild ( $ nextNode ) ; } else { //scan upwards till we find a sibling $ curNode = $ domNode -> parentNode ; while ( $ curNode !== $ topNode ) { if ( $ curNode -> nextSibling !== null ) { $ curNode = $ curNode -> nextSibling ; self :: removeProceedingNodes ( $ curNode , $ topNode ) ; $ curNode -> parentNode -> removeChild ( $ curNode ) ; break ; } $ curNode = $ curNode -> parentNode ; } } }
docstring: Removes all nodes after the current node.
  @param  DOMNode|DOMElement $domNode
  @param  DOMNode|DOMElement $topNode
  @return void
docstring_tokens: Removes all nodes after the current node .