Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
FunctionExtension example
private
array
$functionTranslators
=
[
]
;
private
array
$pseudoClassTranslators
=
[
]
;
private
array
$attributeMatchingTranslators
=
[
]
;
public
function
__construct
(
ParserInterface
$parser
= null
)
{
$this
->mainParser =
$parser
??
new
Parser
(
)
;
$this
->
registerExtension
(
new
Extension\
NodeExtension
(
)
)
->
registerExtension
(
new
Extension\
CombinationExtension
(
)
)
->
registerExtension
(
new
Extension\
FunctionExtension
(
)
)
->
registerExtension
(
new
Extension\
PseudoClassExtension
(
)
)
->
registerExtension
(
new
Extension\
AttributeMatchingExtension
(
)
)
;
}
public
static
function
getXpathLiteral
(
string
$element
)
: string
{
if
(
!
str_contains
(
$element
, "'"
)
)
{
return
"'".
$element
."'";
}