JoliTypo\Fixer::doFix PHP Method

doFix() private method

Run the Fixers on a DOMText content.
private doFix ( DOMText $childNode, DOMNode $node, DOMDocument $dom )
$childNode DOMText The node to fix
$node DOMNode The parent node where to replace the current one
$dom DOMDocument The Document
    private function doFix(\DOMText $childNode, \DOMNode $node, \DOMDocument $dom)
    {
        $content = $childNode->wholeText;
        $current_node = new StateNode($childNode, $node, $dom);
        $this->stateBag->setCurrentNode($current_node);
        // run the string on all the fixers
        foreach ($this->_rules as $fixer) {
            $content = $fixer->fix($content, $this->stateBag);
        }
        // update the DOM only if the node has changed
        if ($childNode->wholeText !== $content) {
            $new_node = $dom->createTextNode($content);
            $node->replaceChild($new_node, $childNode);
            // As the node is replaced, we also update it in the StateNode
            $current_node->replaceNode($new_node);
        }
    }