src/JoliTypo/Fixer.php
private function processDOM(\DOMNode $node, \DOMDocument $dom)
    {
        if ($node->hasChildNodes()) {
            $nodes = [];
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof \DOMElement && $childNode->tagName) {
                    if (in_array($childNode->tagName, $this->protectedTags)) {
                        continue;
                    }
                }

                $nodes[] = $childNode;
            }

            $depth = $this->stateBag->getCurrentDepth();

            foreach ($nodes as $childNode) {
                if ($childNode instanceof \DOMText && !$childNode->isWhitespaceInElementContent()) {
                    $this->stateBag->setCurrentDepth($depth);
                    $this->doFix($childNode, $node, $dom);
                } else {
                    $this->stateBag->setCurrentDepth($this->stateBag->getCurrentDepth() + 1);
                    $this->processDOM($childNode, $dom);
                }
            }
        }
    }
private function processDOM(\DOMNode $node, \DOMDocument $dom)
    {
        if ($node->hasChildNodes()) {
            $nodes = [];
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof \DOMElement && $childNode->tagName) {
                    if (in_array($childNode->tagName, $this->protectedTags)) {
                        continue;
                    }
                }

                $nodes[] = $childNode;
            }

            $depth = $this->stateBag->getCurrentDepth();

            foreach ($nodes as $childNode) {
                if ($childNode instanceof \DOMText && !$childNode->isWhitespaceInElementContent()) {
                    $this->stateBag->setCurrentDepth($depth);
                    $this->doFix($childNode, $node, $dom);
                } else {
                    $this->stateBag->setCurrentDepth($this->stateBag->getCurrentDepth() + 1);
                    $this->processDOM($childNode, $dom);
                }
            }
        }
    }
private function processDOM ( \ DOMNode $ node , \ DOMDocument $ dom ) { if ( $ node -> hasChildNodes ( ) ) { $ nodes = [ ] ; foreach ( $ node -> childNodes as $ childNode ) { if ( $ childNode instanceof \ DOMElement && $ childNode -> tagName ) { if ( in_array ( $ childNode -> tagName , $ this -> protectedTags ) ) { continue ; } } $ nodes [ ] = $ childNode ; } $ depth = $ this -> stateBag -> getCurrentDepth ( ) ; foreach ( $ nodes as $ childNode ) { if ( $ childNode instanceof \ DOMText && ! $ childNode -> isWhitespaceInElementContent ( ) ) { $ this -> stateBag -> setCurrentDepth ( $ depth ) ; $ this -> doFix ( $ childNode , $ node , $ dom ) ; } else { $ this -> stateBag -> setCurrentDepth ( $ this -> stateBag -> getCurrentDepth ( ) + 1 ) ; $ this -> processDOM ( $ childNode , $ dom ) ; } } } }
Loop over all the DOMNode recursively.

@param \DOMNode     $node
@param \DOMDocument $dom
Loop over all the DOMNode recursively .