original_string: protected function replaceCallback(\DOMNode $node)
      {
          return function ($text) use ($node) {
              $attribute = '';
              if ($node instanceof \DOMText) {
                  $attribute = 'nodeValue';
              } elseif ($node instanceof \DOMAttr) {
                  $attribute = 'value';
              }
  
              if ($attribute === '') {
                  throw new ParserCrawlerAfterListenerException('No callback behavior set for this node type.');
              }
  
              // reserved character in XML: &
              $text = str_replace('&amp;', '&', $text);
              $text = str_replace('&', '&amp;', $text);
              $text = str_replace('&lt;', '<', $text);
              $text = str_replace('&gt;', '>', $text);
  
              $node->$attribute = $text;
          };
      }
code: protected function replaceCallback(\DOMNode $node)
      {
          return function ($text) use ($node) {
              $attribute = '';
              if ($node instanceof \DOMText) {
                  $attribute = 'nodeValue';
              } elseif ($node instanceof \DOMAttr) {
                  $attribute = 'value';
              }
  
              if ($attribute === '') {
                  throw new ParserCrawlerAfterListenerException('No callback behavior set for this node type.');
              }
  
              // reserved character in XML: &
              $text = str_replace('&amp;', '&', $text);
              $text = str_replace('&', '&amp;', $text);
              $text = str_replace('&lt;', '<', $text);
              $text = str_replace('&gt;', '>', $text);
  
              $node->$attribute = $text;
          };
      }
code_tokens: protected function replaceCallback ( \ DOMNode $ node ) { return function ( $ text ) use ( $ node ) { $ attribute = '' ; if ( $ node instanceof \ DOMText ) { $ attribute = 'nodeValue' ; } elseif ( $ node instanceof \ DOMAttr ) { $ attribute = 'value' ; } if ( $ attribute === '' ) { throw new ParserCrawlerAfterListenerException ( 'No callback behavior set for this node type.' ) ; } // reserved character in XML: & $ text = str_replace ( '&amp;' , '&' , $ text ) ; $ text = str_replace ( '&' , '&amp;' , $ text ) ; $ text = str_replace ( '&lt;' , '<' , $ text ) ; $ text = str_replace ( '&gt;' , '>' , $ text ) ; $ node -> $ attribute = $ text ; } ; }
docstring: Callback used to replace text with translated version
  
  @param \DOMNode $node
  @return callable
docstring_tokens: Callback used to replace text with translated version