FluentDOM\Nodes\Fetcher::filterNodes PHP Method

filterNodes() private method

private filterNodes ( array $nodes, callable $filter = NULL, callable $stopAt = NULL, integer $options ) : array
$nodes array
$filter callable
$stopAt callable
$options integer
return array
    private function filterNodes(array $nodes, callable $filter = NULL, callable $stopAt = NULL, $options = 0)
    {
        $result = array();
        foreach ($nodes as $index => $node) {
            list($isFilter, $isStopAt) = $this->getNodeStatus($node, $index, $filter, $stopAt);
            if ($isStopAt) {
                if ($isFilter && Constraints::hasOption($options, self::INCLUDE_STOP)) {
                    $result[] = $node;
                }
                return $result;
            } elseif ($isFilter) {
                $result[] = $node;
            }
        }
        return $result;
    }