Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTestNodeClass example
private
function
parseNotTestExpression
(
Node
$node
)
: NotUnary
{
return
new
NotUnary
(
$this
->
parseTestExpression
(
$node
)
,
$this
->parser->
getCurrentToken
(
)
->
getLine
(
)
)
;
}
private
function
parseTestExpression
(
Node
$node
)
: TestExpression
{
$stream
=
$this
->parser->
getStream
(
)
;
list
(
$name
,
$test
)
=
$this
->
getTest
(
$node
->
getTemplateLine
(
)
)
;
$class
=
$this
->
getTestNodeClass
(
$test
)
;
$arguments
= null;
if
(
$stream
->
test
(
/* Token::PUNCTUATION_TYPE */ 9, '('
)
)
{
$arguments
=
$this
->
parseArguments
(
true
)
;
}
elseif
(
$test
->
hasOneMandatoryArgument
(
)
)
{
$arguments
=
new
Node
(
[
0 =>
$this
->
parsePrimaryExpression
(
)
]
)
;
}
if
(
'defined' ===
$name
&&
$node
instanceof NameExpression && null !==
$alias
=
$this
->parser->
getImportedSymbol
(
'function',
$node
->
getAttribute
(
'name'
)
)
)
{
$node
=
new
MethodCallExpression
(
$alias
[
'node'
]
,
$alias
[
'name'
]
,
new
ArrayExpression
(
[
]
,
$node
->
getTemplateLine
(
)
)
,
$node
->
getTemplateLine
(
)
)
;
$node
->
setAttribute
(
'safe', true
)
;
}