class Normalizer extends IRProcessor

Constants

XMLNS_XSL

XSL namespace

Properties

protected DOMXPath $xpath from  IRProcessor
protected Optimizer $optimizer
string $voidRegexp

Methods

appendElement(DOMElement $parentNode, string $name, string $value = '')

Create and append an element to given node in the IR

void
createXPath(DOMDocument $dom)

Create and store an instance of DOMXPath for given document

mixed
evaluate(string $expr, DOMNode $node = null)

Evaluate an XPath expression and return its result

query(string $query, DOMNode $node = null)

Run an XPath query and return its result

void
__construct(Optimizer $optimizer)

No description

void
normalize(DOMDocument $ir)

Normalize an IR

void
addCloseTagElements(DOMDocument $ir)

Add elements everywhere an open start tag should be closed

void
addDefaultCase()

Add an empty default to nodes that don't have one

void
addElementIds()

Add an id attribute to nodes

string
getOutputContext(DOMNode $output)

Get the context type for given output element

string|null
getParentElementId(DOMNode $node)

Get the ID of the closest "element" ancestor

void
markBranchTables()

Mark switch elements that are used as branch tables

void
markSwitchTable(DOMElement $switch)

Mark given switch element if it's used as a branch table

void
markConditionalCloseTagElements()

Mark conditional nodes

void
markBooleanAttributes()

Mark boolean attributes

void
markVoidElements()

Mark void elements

void
setOutputContext()

Fill in output context

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

Parameters

DOMElement $parentNode

Parent node of the element

string $name

Tag name of the element

string $value

Value of the element

Return Value

DOMElement

The created element

in IRProcessor at line 46
protected void createXPath(DOMDocument $dom)

Create and store an instance of DOMXPath for given document

Parameters

DOMDocument $dom

Return Value

void

in IRProcessor at line 58
protected mixed evaluate(string $expr, DOMNode $node = null)

Evaluate an XPath expression and return its result

Parameters

string $expr

XPath expression

DOMNode $node

Context node

Return Value

mixed

in IRProcessor at line 70
protected DOMNodeList query(string $query, DOMNode $node = null)

Run an XPath query and return its result

Parameters

string $query

XPath query

DOMNode $node

Context node

Return Value

DOMNodeList

at line 32
void __construct(Optimizer $optimizer)

No description

Parameters

Optimizer $optimizer

Return Value

void

at line 43
void normalize(DOMDocument $ir)

Normalize an IR

Parameters

DOMDocument $ir

Return Value

void

at line 63
protected void addCloseTagElements(DOMDocument $ir)

Add elements everywhere an open start tag should be closed

Parameters

DOMDocument $ir

Return Value

void

at line 95
protected void addDefaultCase()

Add an empty default to nodes that don't have one

Return Value

void

at line 108
protected void addElementIds()

Add an id attribute to nodes

Return Value

void

at line 123
protected string getOutputContext(DOMNode $output)

Get the context type for given output element

Parameters

DOMNode $output

Return Value

string

at line 147
protected string|null getParentElementId(DOMNode $node)

Get the ID of the closest "element" ancestor

Parameters

DOMNode $node

Context node

Return Value

string|null

at line 170
protected void markBranchTables()

Mark switch elements that are used as branch tables

If a switch is used for a series of equality tests against the same attribute or variable, the attribute/variable is stored within the switch as "branch-key" and the values it is compared against are stored JSON-encoded in the case as "branch-values". It can be used to create optimized branch tables

Return Value

void

at line 185
protected void markSwitchTable(DOMElement $switch)

Mark given switch element if it's used as a branch table

Parameters

DOMElement $switch

Return Value

void

at line 217
protected void markConditionalCloseTagElements()

Mark conditional nodes

Return Value

void

at line 248
protected void markBooleanAttributes()

Mark boolean attributes

The test is case-sensitive and only covers attribute that are minimized by libxslt

Return Value

void

at line 265
protected void markVoidElements()

Mark void elements

Return Value

void

at line 289
protected void setOutputContext()

Fill in output context

Return Value

void