class XPathConvertor

Properties

array $features
protected RecursiveParser $parser

Methods

__construct(RecursiveParser|null $parser = null)

Constructor

string
convertCondition(string $expr)

Convert an XPath expression (used in a condition) into PHP code

string
convertXPath(string $expr)

Convert an XPath expression (used as value) into PHP code

string
exportXPath(string $expr)

Export an XPath expression as PHP with special consideration for XPath variables

string
exportXPathCurrent()

Convert a "current()" XPath expression to its PHP source representation

string
exportXPathFragment(string $fragment)

Convert a fragment of an XPath expression to its PHP source representation

string
exportXPathParam(string $param)

Convert an XSLT parameter to its PHP source representation

getDefaultParser()

Generate and return the a parser with the default set of matchers

getParser()

Return (and if necessary, create) the cached instance of the XPath parser

array
tokenizeXPathForExport(string $expr)

Tokenize an XPath expression for use in PHP

Details

at line 37
__construct(RecursiveParser|null $parser = null)

Constructor

Parameters

RecursiveParser|null $parser

at line 58
string convertCondition(string $expr)

Convert an XPath expression (used in a condition) into PHP code

This method is similar to convertXPath() but it selectively replaces some simple conditions with the corresponding DOM method for performance reasons

Parameters

string $expr

XPath expression

Return Value

string

PHP code

at line 99
string convertXPath(string $expr)

Convert an XPath expression (used as value) into PHP code

Parameters

string $expr

XPath expression

Return Value

string

PHP code

at line 129
protected string exportXPath(string $expr)

Export an XPath expression as PHP with special consideration for XPath variables

Will return PHP source representing the XPath expression, with special consideration for XPath variables which are returned as a method call to XPath::export()

Parameters

string $expr

XPath expression

Return Value

string

PHP representation of the expression

at line 146
protected string exportXPathCurrent()

Convert a "current()" XPath expression to its PHP source representation

Return Value

string

at line 157
protected string exportXPathFragment(string $fragment)

Convert a fragment of an XPath expression to its PHP source representation

Parameters

string $fragment

Return Value

string

at line 168
protected string exportXPathParam(string $param)

Convert an XSLT parameter to its PHP source representation

Parameters

string $param

Parameter, including the leading $

Return Value

string

at line 180
protected RecursiveParser getDefaultParser()

Generate and return the a parser with the default set of matchers

Return Value

RecursiveParser

at line 210
protected RecursiveParser getParser()

Return (and if necessary, create) the cached instance of the XPath parser

Return Value

RecursiveParser

at line 226
protected array tokenizeXPathForExport(string $expr)

Tokenize an XPath expression for use in PHP

Parameters

string $expr

XPath expression

Return Value

array