Optimizer
class Optimizer extends IRProcessor
Constants
XMLNS_XSL |
XSL namespace |
Properties
protected DOMXPath | $xpath | from IRProcessor |
Methods
Create and append an element to given node in the IR
Evaluate an XPath expression and return its result
Clone closeTag elements that follow a switch into said switch
Clone closeTag elements from the head of a switch's cases before said switch
Merge consecutive literal outputs
Test whether the next sibling of an element is a literal output element with matching escaping
Optimize closeTags elements
Remove redundant closeTag siblings after a switch
Remove content from void elements
Remove empty default cases (no test and no descendants)
Remove all nodes that match given XPath query
Remove redundant closeTag elements from the tail of a switch's cases
Remove redundant closeTag elements from the tail of a switch's cases
Details
in
IRProcessor at line 35
protected DOMElement
appendElement(DOMElement $parentNode, string $name, string $value = '')
Create and append an element to given node in the IR
in
IRProcessor at line 46
protected void
createXPath(DOMDocument $dom)
Create and store an instance of DOMXPath for given document
in
IRProcessor at line 58
protected mixed
evaluate(string $expr, DOMNode|null $node = null)
Evaluate an XPath expression and return its result
in
IRProcessor at line 70
protected DOMNodeList
query(string $query, DOMNode|null $node = null)
Run an XPath query and return its result
at line 22
void
optimize(DOMDocument $ir)
Optimize an IR
at line 55
protected void
cloneCloseTagElementsIntoSwitch()
Clone closeTag elements that follow a switch into said switch
If there's a
at line 79
protected void
cloneCloseTagElementsOutOfSwitch()
Clone closeTag elements from the head of a switch's cases before said switch
If there's a
at line 94
protected void
mergeConsecutiveLiteralOutputElements()
Merge consecutive literal outputs
at line 114
protected bool
nextSiblingIsLiteralOutput(DOMElement $node, string $disableOutputEscaping)
Test whether the next sibling of an element is a literal output element with matching escaping
at line 124
protected void
optimizeCloseTagElements()
Optimize closeTags elements
at line 139
protected void
removeCloseTagSiblings()
Remove redundant closeTag siblings after a switch
If all branches of a switch have a closeTag we can remove any closeTag siblings of the switch
at line 153
protected void
removeContentFromVoidElements()
Remove content from void elements
For each void element, we find whichever
at line 169
protected void
removeEmptyDefaultCases()
Remove empty default cases (no test and no descendants)
at line 182
protected void
removeNodes(string $query, DOMNode|null $contextNode = null)
Remove all nodes that match given XPath query
at line 201
protected void
removeRedundantCloseTagElements()
Remove redundant closeTag elements from the tail of a switch's cases
For each
at line 220
protected void
removeRedundantCloseTagElementsInSwitch()
Remove redundant closeTag elements from the tail of a switch's cases
If there's a