original_string: protected function tokenizeDOM($node, &$tokens, $config)
      {
          $level = 0;
          $nodes = array($level => new HTMLPurifier_Queue(array($node)));
          $closingNodes = array();
          do {
              while (!$nodes[$level]->isEmpty()) {
                  $node = $nodes[$level]->shift(); // FIFO
                  $collect = $level > 0 ? true : false;
                  $needEndingTag = $this->createStartNode($node, $tokens, $collect, $config);
                  if ($needEndingTag) {
                      $closingNodes[$level][] = $node;
                  }
                  if ($node->childNodes && $node->childNodes->length) {
                      $level++;
                      $nodes[$level] = new HTMLPurifier_Queue();
                      foreach ($node->childNodes as $childNode) {
                          $nodes[$level]->push($childNode);
                      }
                  }
              }
              $level--;
              if ($level && isset($closingNodes[$level])) {
                  while ($node = array_pop($closingNodes[$level])) {
                      $this->createEndNode($node, $tokens);
                  }
              }
          } while ($level > 0);
      }
code: protected function tokenizeDOM($node, &$tokens, $config)
      {
          $level = 0;
          $nodes = array($level => new HTMLPurifier_Queue(array($node)));
          $closingNodes = array();
          do {
              while (!$nodes[$level]->isEmpty()) {
                  $node = $nodes[$level]->shift(); // FIFO
                  $collect = $level > 0 ? true : false;
                  $needEndingTag = $this->createStartNode($node, $tokens, $collect, $config);
                  if ($needEndingTag) {
                      $closingNodes[$level][] = $node;
                  }
                  if ($node->childNodes && $node->childNodes->length) {
                      $level++;
                      $nodes[$level] = new HTMLPurifier_Queue();
                      foreach ($node->childNodes as $childNode) {
                          $nodes[$level]->push($childNode);
                      }
                  }
              }
              $level--;
              if ($level && isset($closingNodes[$level])) {
                  while ($node = array_pop($closingNodes[$level])) {
                      $this->createEndNode($node, $tokens);
                  }
              }
          } while ($level > 0);
      }
code_tokens: protected function tokenizeDOM ( $ node , & $ tokens , $ config ) { $ level = 0 ; $ nodes = array ( $ level => new HTMLPurifier_Queue ( array ( $ node ) ) ) ; $ closingNodes = array ( ) ; do { while ( ! $ nodes [ $ level ] -> isEmpty ( ) ) { $ node = $ nodes [ $ level ] -> shift ( ) ; // FIFO $ collect = $ level > 0 ? true : false ; $ needEndingTag = $ this -> createStartNode ( $ node , $ tokens , $ collect , $ config ) ; if ( $ needEndingTag ) { $ closingNodes [ $ level ] [ ] = $ node ; } if ( $ node -> childNodes && $ node -> childNodes -> length ) { $ level ++ ; $ nodes [ $ level ] = new HTMLPurifier_Queue ( ) ; foreach ( $ node -> childNodes as $ childNode ) { $ nodes [ $ level ] -> push ( $ childNode ) ; } } } $ level -- ; if ( $ level && isset ( $ closingNodes [ $ level ] ) ) { while ( $ node = array_pop ( $ closingNodes [ $ level ] ) ) { $ this -> createEndNode ( $ node , $ tokens ) ; } } } while ( $ level > 0 ) ; }
docstring: Iterative function that tokenizes a node, putting it into an accumulator.
  To iterate is human, to recurse divine - L. Peter Deutsch
  @param DOMNode $node DOMNode to be tokenized.
  @param HTMLPurifier_Token[] $tokens   Array-list of already tokenized tokens.
  @return HTMLPurifier_Token of node appended to previously passed tokens.
docstring_tokens: Iterative function that tokenizes a node putting it into an accumulator . To iterate is human to recurse divine - L . Peter Deutsch