Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPreservesSafety example
elseif
(
$node
instanceof ConditionalExpression
)
{
// intersect safeness of both operands
$safe
=
$this
->
intersectSafe
(
$this
->
getSafe
(
$node
->
getNode
(
'expr2'
)
)
,
$this
->
getSafe
(
$node
->
getNode
(
'expr3'
)
)
)
;
$this
->
setSafe
(
$node
,
$safe
)
;
}
elseif
(
$node
instanceof FilterExpression
)
{
// filter expression is safe when the filter is safe
$name
=
$node
->
getNode
(
'filter'
)
->
getAttribute
(
'value'
)
;
$args
=
$node
->
getNode
(
'arguments'
)
;
if
(
$filter
=
$env
->
getFilter
(
$name
)
)
{
$safe
=
$filter
->
getSafe
(
$args
)
;
if
(
null ===
$safe
)
{
$safe
=
$this
->
intersectSafe
(
$this
->
getSafe
(
$node
->
getNode
(
'node'
)
)
,
$filter
->
getPreservesSafety
(
)
)
;
}
$this
->
setSafe
(
$node
,
$safe
)
;
}
else
{
$this
->
setSafe
(
$node
,
[
]
)
;
}
}
elseif
(
$node
instanceof FunctionExpression
)
{
// function expression is safe when the function is safe
$name
=
$node
->
getAttribute
(
'name'
)
;
$args
=
$node
->
getNode
(
'arguments'
)
;
if
(
$function
=
$env
->
getFunction
(
$name
)
)
{
$this
->
setSafe
(
$node
,
$function
->
getSafe
(
$args
)
)
;
}