public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$output = array();
$outputNodePaths = array();
if (isset($arguments[0]) && !empty($arguments[0])) {
$parsedFilter = FizzleParser::parseFilterGroup($arguments[0]);
if ($this->earlyOptimizationOfFilters($flowQuery, $parsedFilter)) {
return;
}
}
/** @var NodeInterface $contextNode */
foreach ($flowQuery->getContext() as $contextNode) {
/** @var NodeInterface $childNode */
foreach ($contextNode->getChildNodes() as $childNode) {
if (!isset($outputNodePaths[$childNode->getPath()])) {
$output[] = $childNode;
$outputNodePaths[$childNode->getPath()] = true;
}
}
}
$flowQuery->setContext($output);
if (isset($arguments[0]) && !empty($arguments[0])) {
$flowQuery->pushOperation('filter', $arguments);
}
}