{@inheritdoc}

@param FlowQuery $flowQuery the FlowQuery object
@param array $arguments the arguments for this operation
@todo Compare to node type Neos.Neos:Site instead of path once it is available
@return void
164513
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $parents = [];
        /* @var TraversableNodeInterface $contextNode */
        foreach ($flowQuery->getContext() as $contextNode) {
            $node = $contextNode;
            do {
                try {
                    $node = $node->findParentNode();
                } catch (NodeException $exception) {
                    break;
                }
                // stop at sites
                if ($node->findNodePath() == SiteService::SITES_ROOT_PATH) {
                    break;
                }
                $parents[] = $node;
            } while (true);
        }

        $flowQuery->setContext($parents);

        if (isset($arguments[0]) && !empty($arguments[0])) {
            $flowQuery->pushOperation('filter', $arguments);
        }
    }
1210620
public function evaluate(FlowQuery $flowQuery, array $arguments) {
        if (!isset($arguments[0]) || empty($arguments[0])) {
            throw new FlowQueryException('sort() needs property name by which nodes should be sorted', 1332492263);
        } else {
            $nodes = $flowQuery->getContext();
            $sortByPropertyPath = $arguments[0];
            $sortOrder = 'DESC';
            if (isset($arguments[1]) && !empty($arguments[1]) && in_array($arguments[1], array('ASC', 'DESC'))) {
                $sortOrder = $arguments[1];
            }

            $sortedNodes = array();
            $sortSequence = array();
            $nodesByIdentifier = array();
            /** @var Node $node */
            foreach ($nodes as $node) {
                $propertyValue = $node->getProperty($sortByPropertyPath);
                if ($propertyValue instanceof \DateTime) {
                    $propertyValue = $propertyValue->getTimestamp();
                }
                $sortSequence[$node->getIdentifier()] = $propertyValue;
                $nodesByIdentifier[$node->getIdentifier()] = $node;
            }
            if ($sortOrder === 'DESC') {
                arsort($sortSequence);
            } else {
                asort($sortSequence);
            }
            foreach ($sortSequence as $nodeIdentifier => $value) {
                $sortedNodes[] = $nodesByIdentifier[$nodeIdentifier];
            }
            $flowQuery->setContext($sortedNodes);
        }
    }
589278
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $output = [];
        $outputNodeAggregateIdentifiers = [];
        if (isset($arguments[0]) && !empty($arguments[0])) {
            $parsedFilter = FizzleParser::parseFilterGroup($arguments[0]);
            if ($this->earlyOptimizationOfFilters($flowQuery, $parsedFilter)) {
                return;
            }
        }

        /** @var TraversableNodeInterface $contextNode */
        foreach ($flowQuery->getContext() as $contextNode) {
            foreach ($contextNode->findChildNodes() as $childNode) {
                if (!isset($outputNodeAggregateIdentifiers[(string)$childNode->getNodeAggregateIdentifier()])) {
                    $output[] = $childNode;
                    $outputNodeAggregateIdentifiers[(string)$childNode->getNodeAggregateIdentifier()] = true;
                }
            }
        }
        $flowQuery->setContext($output);

        if (isset($arguments[0]) && !empty($arguments[0])) {
            $flowQuery->pushOperation('filter', $arguments);
        }
    }
1218563
public function sendWriteQuery($query, array $parameters = array())
    {
        return $this->sendCypherQuery($query, $parameters, $this->getWriteConnection()->getAlias(), self::WRITE_QUERY);
    }
253827
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for RunCommandTask, got "%s"', get_class($application)));

        $options = $this->configureOptions($options);

        $targetPath = $deployment->getApplicationReleasePath($application);

        $command = sprintf('cd %s && FLOW_CONTEXT=%s ./%s %s', $targetPath, $application->getContext(), $application->getFlowScriptName(), $options['command']);

        $this->shell->executeOrSimulate($command, $node, $deployment, $options['ignoreErrors'], $options['logOutput']);
    }
1315959
public function execute(string $view, array $arguments)
    {
        /**
         * @var Closure $sandbox
         * @var Context $content
         */

        /**
         * @param string $__flow__view
         *
         * @return string
         */
        $sandbox = function (string $__flow__view)
        {
            include $this->native->path($__flow__view);

            return $this->ext->blocks()->getExtends();
        };

        $content  = clone $this->content;
        $_view    = $view;
        $iterator = 0;

        $content->mergeData($arguments);

        do
        {
            if ($iterator >= $this->limit)
            {
                throw new Runtime('The application is not responding');
            }

            $iterator++;

            $_view = $sandbox->call(
                $content,
                $_view
            );
        }
        while ($_view);
    }
1029192
protected function multiQuery(string $queries): void
  {
    if ($this->logQueries)
    {
      $time0 = microtime(true);

      $tmp = $this->mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException($this->mysqli->errno, $this->mysqli->error, $queries);
      }

      $this->queryLog[] = ['query' => $queries, 'time' => microtime(true) - $time0];
    }
    else
    {
      $tmp = $this->mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException($this->mysqli->errno, $this->mysqli->error, $queries);
      }
    }
  }
769738
protected function _setQuery(string $type, $args): self
    {
        if (!\is_array($args) && !($args instanceof AbstractSpanQuery)) {
            throw new InvalidException('Invalid parameter. Has to be array or instance of Elastica\Query\AbstractSpanQuery');
        }

        return $this->setParam($type, $args);
    }
1029647
public function addQueries(array $queries = array()) {
	    foreach($queries as $queryInfo) {
	        $batchAction = (isset($queryInfo[1])) ? $queryInfo[1] : null;
	        $this->addQuery($queryInfo[0], $batchAction);
	    }
	}
1042904
public function addQueries(array $queries) : self
    {
        foreach ($queries as $key => $value) {
            if (is_null($value)) {
                continue;
            }

            if (!is_string($key)) {
                throw new \InvalidArgumentException("Invalid querystring '" . $key . "'");
            }

            if (!is_string($value) && !is_array($value)) {
                throw new \InvalidArgumentException(sprintf(
                    "Invalid querystring value '%s' with type '%s'",
                    $key,
                    gettype($value)
                ));
            }

            $this->uri['query'][$key] = $value;
        }

        return $this;
    }
1058733
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $valuesToRemove = [];
        if (isset($arguments[0])) {
            if (is_array($arguments[0])) {
                $valuesToRemove = $arguments[0];
            } elseif ($arguments[0] instanceof \Traversable) {
                $valuesToRemove = iterator_to_array($arguments[0]);
            } else {
                $valuesToRemove[] = $arguments[0];
            }
        }
        $filteredContext = array_filter(
            $flowQuery->getContext(),
            function ($item) use ($valuesToRemove) {
                return in_array($item, $valuesToRemove, true) === false;
            }
        );
        $flowQuery->setContext($filteredContext);
    }
729467
protected function applyContextStrategyToQueryBuilder($query, $strategy, array $parameters = [])
    {
        $strategy = $this->resolveContextStrategy($strategy);

        if ( ! $strategy) return;

        $strategy->apply($query, $parameters);
    }
1078424
public static <T> void invoke(List<QueryExprMeta> queries,
                                  QueryExprInvoker<T> invoker,
                                  ExprApplier<T> exprApplier) {
        for (QueryExprMeta expr : queries) {
            exprApplier.apply(invoker.invoke(expr));
        }
    }
337011
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $term = isset($arguments[0]) ? $arguments[0] : null;
        $filterNodeTypeName = isset($arguments[1]) ? $arguments[1] : null;

        $nodeTypes = strlen($filterNodeTypeName) > 0 ? [$filterNodeTypeName] : array_keys($this->nodeTypeManager->getSubNodeTypes('Neos.Neos:Document', false));

        /** @var NodeInterface $contextNode */
        $contextNode = $flowQuery->getContext()[0];

        $context = $contextNode->getContext();

        if ($term) {
            $matchedNodes = $this->nodeSearchService->findByProperties($term, $nodeTypes, $context, $contextNode);
        } else {
            $matchedNodes = [];
            // Yep, an internal API. But that's what we used in the old UI.
            $nodeDataRecords = $this->nodeDataRepository->findByParentAndNodeTypeRecursively($contextNode->getPath(), implode(',', $nodeTypes), $context->getWorkspace(), $context->getDimensions());
            foreach ($nodeDataRecords as $nodeData) {
                $matchedNode = $this->nodeFactory->createFromNodeData($nodeData, $context);
                if ($matchedNode !== null) {
                    $matchedNodes[$matchedNode->getPath()] = $matchedNode;
                }
            }
        }

        $flowQuery->setContext($matchedNodes);
    }
602052
private function runQuery(Query $query, $executeQueries = false)
    {
        $this->playedQueries[] = $query;
        if ($executeQueries) {
            $this->connection->executeQuery((string)$query);
        }
    }
197260
public void setFlowLogs(java.util.Collection<FlowLog> flowLogs) {
        if (flowLogs == null) {
            this.flowLogs = null;
            return;
        }

        this.flowLogs = new com.amazonaws.internal.SdkInternalList<FlowLog>(flowLogs);
    }
93401
public function triggerFlow(array $flow, ...$args)
    {
        foreach ($flow as $i => $step) {
            //subflows will trigger separately
            if (is_array($step)) {
                continue;
            }

            //rule the subtasks first
            $j = 1;

            while (isset($flow[$i + $j]) && is_array($flow[$i + $j])) {
                //subflows should have
                //an event and a handler
                if (count($flow[$i + $j]) > 1) {
                    //the subflow is valid
                    //extract the event out
                    $event = array_shift($flow[$i + $j]);
                    self::$flows[$event] = $flow[$i + $j];
                }

                $j++;
            }

            //now trigger the event
            $this->trigger($step, ...$args);

            self::$flows = [];

            //analyze the meta
            $meta = $this->getEventHandler()->getMeta();

            //if status is incomplete
            if ($meta === EventHandler::STATUS_INCOMPLETE) {
                //we should also stop the flow
                break;
            }
        }

        return $this;
    }