class FoldArithmeticConstants extends AbstractConstantFolding

Constants

XMLNS_XSL

XSL namespace

Properties

protected Document $ownerDocument from  AbstractNormalization
protected array $queries {@inheritdoc} from  AbstractConstantFolding

Methods

void
normalize(Element $template)

Apply this normalization rule to given template

Text
createPolymorphicText(string $textContent)

Create an xsl:text element or a text node in current template

array
getNodes()

Query and return a list of nodes of interest

bool
isXsl(DOMNode $node, string $localName = null)

Test whether given node is an XSL element

string
lowercase(string $str)

Make an ASCII string lowercase

void
normalizeAttribute(Attr $attribute)

Replace constant expressions in given attribute's AVT

void
normalizeCdataSection(CdataSection $comment)

No description

void
normalizeComment(Comment $comment)

No description

void
normalizeElement(Element $element)

Replace constant expressions in given XSL element

void
normalizeNode(DOMNode $node)

No description

void
normalizeText(Text $node)

No description

void
reset()

Reset this instance's properties after usage

array
getOptimizationPasses()

Return the optimization passes supported by the concrete implementation

string
evaluateExpression(string $expr)

Evaluate given expression and return the result

string
foldAdditiveIdentity(array $m)

Remove "+ 0" additions

string
foldDivision(array $m)

Evaluate and return the result of a division

string
foldMultiplication(array $m)

Evaluate and return the result of a multiplication

string
foldOperation(array $m)

Evaluate and replace a constant operation

string
foldSubExpression(array $m)

Evaluate and return the result of a simple subexpression

string
removeParentheses(array $m)

Remove the parentheses around an integer

Details

void normalize(Element $template)

Apply this normalization rule to given template

Parameters

Element $template

node

Return Value

void

protected Text createPolymorphicText(string $textContent)

Create an xsl:text element or a text node in current template

Parameters

string $textContent

Return Value

Text

protected array getNodes()

Query and return a list of nodes of interest

Return Value

array

protected bool isXsl(DOMNode $node, string $localName = null)

Test whether given node is an XSL element

Parameters

DOMNode $node
string $localName

Return Value

bool

protected string lowercase(string $str)

Make an ASCII string lowercase

Parameters

string $str

Original string

Return Value

string

Lowercased string

protected void normalizeAttribute(Attr $attribute)

Replace constant expressions in given attribute's AVT

Parameters

Attr $attribute

Return Value

void

protected void normalizeCdataSection(CdataSection $comment)

No description

Parameters

CdataSection $comment

Return Value

void

protected void normalizeComment(Comment $comment)

No description

Parameters

Comment $comment

Return Value

void

protected void normalizeElement(Element $element)

Replace constant expressions in given XSL element

Parameters

Element $element

Return Value

void

protected void normalizeNode(DOMNode $node)

No description

Parameters

DOMNode $node

Return Value

void

protected void normalizeText(Text $node)

No description

Parameters

Text $node

Return Value

void

protected void reset()

Reset this instance's properties after usage

Return Value

void

at line 18
protected array getOptimizationPasses()

Return the optimization passes supported by the concrete implementation

Return Value

array

Regexps as keys, method names as values

at line 36
protected string evaluateExpression(string $expr)

Evaluate given expression and return the result

Parameters

string $expr

Return Value

string

at line 51
protected string foldAdditiveIdentity(array $m)

Remove "+ 0" additions

Parameters

array $m

Return Value

string

at line 62
protected string foldDivision(array $m)

Evaluate and return the result of a division

Parameters

array $m

Return Value

string

at line 73
protected string foldMultiplication(array $m)

Evaluate and return the result of a multiplication

Parameters

array $m

Return Value

string

at line 84
protected string foldOperation(array $m)

Evaluate and replace a constant operation

Parameters

array $m

Return Value

string

at line 95
protected string foldSubExpression(array $m)

Evaluate and return the result of a simple subexpression

Parameters

array $m

Return Value

string

at line 106
protected string removeParentheses(array $m)

Remove the parentheses around an integer

Parameters

array $m

Return Value

string