public function replaceNode(DOMText $node) {
    if (preg_match($this->_splitPattern, $node->nodeValue)) {
      // split using the pattern, but capture the delimiter strings
      $parts = preg_split(
        $this->_splitPattern,
        $node->nodeValue,
        -1,
        PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
      );
      $items = [];
      foreach ($parts as $part) {
        $items[] = $this->createNodes($node->ownerDocument, $part);
      }
      // replace the text node
      FluentDOM($node)->replaceWith($items);
    } else {
      FluentDOM($node)
        ->text(
          strtr(FluentDOM($node)->text(), $this->_escapings
        )
      );
    }
  }
public function replaceNode(DOMText $node) {
    if (preg_match($this->_splitPattern, $node->nodeValue)) {
      // split using the pattern, but capture the delimiter strings
      $parts = preg_split(
        $this->_splitPattern,
        $node->nodeValue,
        -1,
        PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
      );
      $items = [];
      foreach ($parts as $part) {
        $items[] = $this->createNodes($node->ownerDocument, $part);
      }
      // replace the text node
      FluentDOM($node)->replaceWith($items);
    } else {
      FluentDOM($node)
        ->text(
          strtr(FluentDOM($node)->text(), $this->_escapings
        )
      );
    }
  }
public function replaceNode ( DOMText $ node ) { if ( preg_match ( $ this -> _splitPattern , $ node -> nodeValue ) ) { // split using the pattern, but capture the delimiter strings $ parts = preg_split ( $ this -> _splitPattern , $ node -> nodeValue , - 1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; $ items = [ ] ; foreach ( $ parts as $ part ) { $ items [ ] = $ this -> createNodes ( $ node -> ownerDocument , $ part ) ; } // replace the text node FluentDOM ( $ node ) -> replaceWith ( $ items ) ; } else { FluentDOM ( $ node ) -> text ( strtr ( FluentDOM ( $ node ) -> text ( ) , $ this -> _escapings ) ) ; } }
Callback used to replace a single text node.

@param DOMText $node
Callback used to replace a single text node .