Returns false if the node fails to match the parameters

@throws NodeException
@param  $node
@param  $filterParams
@param  $metaParams
@return bool
181045
protected function filterNode($node, $filterParams, $metaParams)
    {

        if(!empty($filterParams))
        {

            if(is_null($this->now))
                $this->now = $this->DateFactory->newStorageDate();

            foreach ($filterParams as $key => $value) {
                if (strpos($key, '#') === 0)
                    continue;

                switch($key) {

                    case 'Title.firstChar':
                        $firstChar = strtolower(substr($node['Title'], 0, 1));
                        if($value == '#')
                        {
                            $ord = ord($firstChar);
                            if($ord >= 97 && $ord <= 122)
                                return false;
                        } else if (strcmp($firstChar, $value) !== 0) {
                            return false;
                        }
                        break;

                    case 'Title.eq':
                        if(strcmp($value, $node['Title']) !== 0)
                            return false;
                        break;

                    case 'Title.ieq':
                        if(strcasecmp($value, $node['Title']) !== 0)
                            return false;
                        break;

                    case 'Title.like':
                        if(is_null($value))
                            break;
                        if(stripos($node['Title'],$value) === FALSE)
                            return false;
                        break;

                    case 'TreeID.childOf':
                        if(stripos($node['TreeID'],$value) !== 0)
                            return false;
                        break;

                    case 'TreeID.eq':
                        if(strcmp($value, $node['TreeID']) !== 0)
                            return false;
                        break;

                    case 'TreeID.depth':
                        if((strlen($node['TreeID'])/4) != $value)
                            return false;
                        break;

                    case 'ActiveDate.after':
                        if($node['ActiveDate']->toUnix() < $value->toUnix())
                            return false;
                        break;

                    case 'ActiveDate.before':
                        if($node['ActiveDate']->toUnix() >= $value->toUnix())
                            return false;
                        break;

                    case 'ActiveDate.start':
                        if($node['ActiveDate']->toUnix() <= $value->toUnix())
                            return false;
                        break;

                    case 'ActiveDate.end':
                        if($node['ActiveDate']->toUnix() >= $value->toUnix())
                            return false;
                        break;

                    case 'CreationDate.after':
                        if($node['CreationDate']->toUnix() < $value->toUnix())
                            return false;
                        break;

                    case 'CreationDate.before':
                        if($node['CreationDate']->toUnix() >= $value->toUnix())
                            return false;
                        break;

                    case 'CreationDate.start':
                        if($node['CreationDate']->toUnix() <= $value->toUnix())
                            return false;
                        break;

                    case 'CreationDate.end':
                        if($node['CreationDate']->toUnix() >= $value->toUnix())
                            return false;
                        break;

                    case 'Status.eq':
                        switch(strtolower($value)) {
                            case 'published':
                                if(strtolower($node['Status']) != 'published')
                                    return false;
                                break;
                            case 'draft':
                                if(strtolower($node['Status']) != 'draft')
                                    return false;
                                break;
                            case 'deleted':
                                if(strtolower($node['Status']) != 'deleted')
                                    return false;
                                break;
                            default:
                                if(strtolower($node['Status']) == 'deleted')
                                    return false;
                                break;
                        }
                        break;

                    case 'Status.isActive':
                        if(StringUtils::strToBool($value) == true && (strcmp('published', $node['Status']) !== 0 || $node['ActiveDate']->toUnix() >= $this->now->toUnix()))
                            return false;
                        break;

                    case 'Status.all':
                        if(StringUtils::strToBool($value) == false && strcmp('deleted', $node['Status']) === 0)
                            return false;
                        break;

    //                case 'IncludesMeta':
    //                    $found = false;
    //                    foreach($value as $partial) {
    //                        $meta = MetaUtils::filterMeta($node['Metas'],$partial->getMetaName());
    //                        if($partial->match($meta))
    //                            $found = true;
    //                    }
    //                    if(!$found)
    //                        return false;
    //                    break;

                    case 'Meta.exist':
                        foreach($value as $partial) {
                            $meta = $node->getMeta($partial->getMetaName());
                            if(empty($meta) || !$partial->match($meta)) {
                                return false;
                            }

                        }
                        break;

    //                case 'IncludesOutTags':
    //                    $found = false;
    //                    foreach($value as $partial) {
    //                        foreach($node['OutTags'] as $tag)
    //                        {
    //                            if($this->TagsHelper->matchPartial($partial, $tag)) {
    //                                $found = true;
    //                                break 2;
    //                            }
    //                        }
    //                    }
    //                    if(!$found)
    //                        return false;
    //
    //                    break;

                    case 'OutTags.exist':
                        $found = 0;
                        foreach($value as $partial) {
                            foreach($node['OutTags'] as $tag)
                            {
                                if($this->TagsHelper->matchPartial($partial, $tag)) {
                                    ++$found;
                                    break;
                                }
                            }
                        }
                        if($found != count($value))
                            return false;

                        break;

    //                case 'IncludesInTags':
    //                    $found = false;
    //                    foreach($value as $partial) {
    //                        foreach($node['InTags'] as $tag)
    //                        {
    //                            if($this->TagsHelper->matchPartial($partial, $tag)) {
    //                                $found = true;
    //                                break 2;
    //                            }
    //                        }
    //                    }
    //                    if(!$found)
    //                        return false;
    //
    //                    break;

                    case 'InTags.exist':
                        $found = 0;
                        foreach($value as $partial) {
                            foreach($node['InTags'] as $tag)
                            {
                                if($this->TagsHelper->matchPartial($partial, $tag)) {
                                    ++$found;
                                    break;
                                }
                            }
                        }
                        if($found != count($value))
                            return false;

                        break;

                }
            }
        }

        if (!empty($metaParams)) {
            $schema = $node['NodeRef']->getElement()->getSchema();
            foreach ($metaParams as $mArgs) {
                list($full, $name, $operator, $compareValue) = $mArgs;
                $def = $schema->getMetaDef($name);
                $datatype = $def->Datatype;

                if (is_object($node)) {
                    $realValue = $node->getMetaValue($name);
                } else {
                    $meta = MetaUtils::filterMeta($node['Metas'],$name);
                    $realValue = $meta->getMetaValue();
                }

                if ($datatype == 'flag') {
                    throw new NodeException('Unable to run meta clause on flag datatype');
                }

                switch($operator) {
                    case 'eq':
                        if (in_array($datatype, array('text', 'varchar')))
                            if (strcmp($compareValue, $realValue) !== 0)
                                return false;
                        else
                            if ($compareValue !== $realValue)
                                return false;
                        break;

                    case 'ieq':
                        if (strcasecmp($compareValue, $realValue) !== 0)
                            return false;
                        break;

                    case 'like':
                        if(is_null($compareValue))
                            break;

                        if (stripos($compareValue, $realValue) === FALSE)
                            return false;
                        break;

                    case 'before':
                        $d = $this->DateFactory->newLocalDate($value);
                        if ($realValue->toUnix() <= $d->toUnix())
                            return false;
                        break;

                    case 'after':
                        $d = $this->DateFactory->newLocalDate($compareValue);
                        if ($realValue->toUnix() > $d->toUnix())
                            return false;
                        break;

                    case 'start':
                        $d = $this->DateFactory->newLocalDate($compareValue);
                        $d->setTime(0, 0, 0);
                        if ($realValue->toUnix() >= $d->toUnix())
                            return false;
                        break;

                    case 'end':
                        $d = $this->DateFactory->newLocalDate($compareValue);
                        $d->setTime(23, 59, 59);
                        if ($realValue->toUnix() <= $d->toUnix())
                            return false;
                        break;

                    case 'notEq':
                        if (in_array($datatype, array('text', 'varchar')))
                            if (strcmp($compareValue, $realValue) === 0)
                                return false;
                        else
                            if ($compareValue === $realValue)
                                return false;
                        break;

                    case 'lessThan':
                        if ($compareValue >= $realValue)
                            return false;
                        break;

                    case 'lessThanEq':
                        if ($compareValue > $realValue)
                            return false;
                        break;

                    case 'greaterThan':
                        if ($compareValue <= $realValue)
                            return false;
                        break;

                    case 'greaterThanEq':
                        if ($compareValue < $realValue)
                            return false;
                        break;

                    /*
                     * case insensitive comparison for #meta.in filtering.
                     * works exactly like the SQL SomeValue IN ('item1', 'item2')
                     */
                    case 'in':
                        $inValues = explode(',', $compareValue);
                        $foundValue = false;

                        if (in_array($datatype, array('text', 'varchar'))) {
                            foreach ($inValues as $val) {
                                if (strcasecmp($val, $realValue) === 0) {
                                    $foundValue = true;
                                    break;
                                }
                            }
                        } else {
                            foreach ($inValues as $val) {
                                if ($val === $realValue) {
                                    $foundValue = true;
                                    break;
                                }
                            }
                        }

                        if (!$foundValue) {
                            return false;
                        }

                        break;
                }
            }
        }

        return true;
    }
788520
public static function CreateFilter( $context, $node, $predicateList )
	{
		if ( count( $predicateList ) == 1 )
		{
			/**
			 * @var AbstractNode $predicate
			 */
			$predicate = AbstractNode::Create( $context, $predicateList[0] );
			if ( $predicate instanceof ValueNode )
			{
				/**
				 * @var ValueNode $numexpr
				 */
				$numexpr = $predicate;
				if ( is_int( $numexpr->getContent() ) || $numexpr->getContent() instanceof Integer )
				{
					/**
					 * @var PathStep $res
					 */
					$res = PathStep::Create( $context, $node );
					$res->AddLast( PathStep::fromNodeType( $numexpr->getContent(), XPath2ExprType::PositionFilter ) );
					return $res;
				}
			}
		}

		/**
		 * @var AbstractNode $filterExpr
		 */
		$filterExpr = new FilterExprNode( $context, $node, $predicateList );
		// return new PathStep( $filterExpr );
		return PathStep::fromNode( $filterExpr );
	}
976943
public function checkComparison(array $rule, AbstractNode $node): bool
    {
        if ($rule['key'] == 'plaintext') {
            // plaintext search
            $nodeValue = $node->text();
        } else {
            // normal search
            $nodeValue = $node->getAttribute($rule['key']);
        }

        $check = $this->match($rule['operator'], $rule['value'], $nodeValue);

        // handle multiple classes
        if ( ! $check && $rule['key'] == 'class') {
            $nodeClasses = explode(' ', $node->getAttribute('class'));
            foreach ($nodeClasses as $class) {
                if ( ! empty($class)) {
                    $check = $this->match($rule['operator'], $rule['value'], $class);
                }
                if ($check) {
                    break;
                }
            }
        }

        return $check;
    }
353403
public function enterNode(Node $node)
    {
        if (!$node instanceof Assign) {
            return;
        }

        if (!$node->var instanceof Array_ && !$node->var instanceof List_) {
            return;
        }

        if (!$this->atLeastPhp71 && $node->var instanceof Array_) {
            $msg = "syntax error, unexpected '='";
            throw new ParseErrorException($msg, $node->expr->getLine());
        }

        // Polyfill for PHP-Parser 2.x
        $items = isset($node->var->items) ? $node->var->items : $node->var->vars;

        if ($items === [] || $items === [null]) {
            throw new ParseErrorException('Cannot use empty list', $node->var->getLine());
        }

        $itemFound = false;
        foreach ($items as $item) {
            if ($item === null) {
                continue;
            }

            $itemFound = true;

            // List_->$vars in PHP-Parser 2.x is Variable instead of ArrayItem.
            if (!$this->atLeastPhp71 && $item instanceof ArrayItem && $item->key !== null) {
                $msg = 'Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \',\' or \')\'';
                throw new ParseErrorException($msg, $item->key->getLine());
            }

            if (!self::isValidArrayItem($item)) {
                $msg = 'Assignments can only happen to writable values';
                throw new ParseErrorException($msg, $item->getLine());
            }
        }

        if (!$itemFound) {
            throw new ParseErrorException('Cannot use empty list');
        }
    }
934244
function checkMetaRules(nodePaths, includeChildren, callback) {
            var parameters = {
                command: CONSTANTS.SERVER_WORKER_REQUESTS.CHECK_CONSTRAINTS,
                checkType: 'META', //TODO this should come from a constant
                includeChildren: includeChildren,
                nodePaths: nodePaths,
                commitHash: state.commitHash,
                projectId: state.project.projectId
            };

            storage.simpleRequest(parameters, function (err, result) {
                if (err) {
                    logger.error(err);
                }

                if (result) {
                    client.dispatchEvent(client.CONSTANTS.META_RULES_RESULT, result);
                } else {
                    client.notifyUser({
                        severity: 'error',
                        message: 'Evaluating Meta rules failed with error.'
                    });
                }

                if (callback) {
                    callback(err, result);
                }
            });
        }
260744
public function enterNode(Node $node)
    {
        if (!$node instanceof Instanceof_) {
            return;
        }

        if (($node->expr instanceof Scalar && !$node->expr instanceof Encapsed) || $node->expr instanceof ConstFetch) {
            throw new FatalErrorException(self::EXCEPTION_MSG, 0, E_ERROR, null, $node->getLine());
        }
    }
299896
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Param || ! $parent instanceof FunctionModelInterface) {
            throw new Exception('ParameterNodeParser is made to parse a function parameter node');
        }

        $parameter = new ParameterModel();
        $parameter->setParentNode($parent);
        $parameter->setName($node->var->name);
        $parameter->setIsVariadic($node->variadic);

        if ($node->type !== null) {
            $this->typeNodeParser->invoke($node->type, $parameter);
        }
        if ($node->default !== null) {
            $this->valueNodeParser->invoke($node->default, $parameter);
        }

        $parent->addParameter($parameter);
    }
1019073
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Namespace_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('NamespaceNodeParser is made to parse a namespace node');
        }

        if ($node->name instanceof Node\Name) {
            $parent->setNamespace($node->name->parts);
        }

        $this->preParseUses($node->stmts, $parent);

        $this->parseSubNodes($node->stmts, $parent);
    }
450600
public function match($node, $position, $items)
    {
        $userDefFunction = $this->_userDefFunction;
        return $userDefFunction($node, $this->_input, $position, $items);
    }
488611
protected function compileFilter(Node $node)
    {

        $name = $node->name;

        if (!isset($this->options['filters'][$name]))
            $this->throwException(
                "Filter $name was not defined. Make sure to add it via the [`filters`]-option or the [`->addFilter`]-method ",
                $node
            );

        $result = call_user_func($this->options['filters'][$name], $node, $this->indent(), $this->newLine(), $this);

        return $result instanceof Node ? $this->compileNode($result) : (string)$result;
    }
950892
protected function checkParameter(ASTParameter $param, AbstractNode $node)
    {
        $class = $param->getClass();
        if (empty($class) || $class->isAbstract()) {
            return;
        }

        $this->addViolation($node, [$class->getName()]);
    }
1364084
public function matchExact($meta)
    {
        $metaArray = $meta->toArray();
        foreach (array('MetaName', 'MetaValue') as $key) {
            if (strcmp($metaArray[$key], $this->fields[$key]) !== 0)
                return false;
        }

        return true;
    }
647179
function _filter (node, expr, resultSet) {
        var
            selectedNodes,
            conditions,
            type,
            idx,
            condition;
        if (expr.and) {
            conditions = expr.and;
            type = 0;
        } else if (expr.or) {
            conditions = expr.or;
            type = 1;
        }
        for (idx = 0; idx < conditions.length; ++idx) {
            condition = conditions[idx];
            if (condition.and || condition.or) {
                selectedNodes = [];
                _filter(node, condition, selectedNodes);
            } else {
                selectedNodes = _select(node, condition);
            }
            if (0 === type && selectedNodes.length === 0) {
                return;
            }
            if (1 === type && selectedNodes.length !== 0) {
                resultSet.push(node);
                return;
            }
        }
        if (0 === type) {
            resultSet.push(node);
        }
    }
1190199
private function _match($key, $value, $filter)
    {
        if ($this->scanKeys) {
            if ($filter->match($key)) {
                return true;
            }
        }

        if ($filter->match($value)) {
            return true;
        }

        return false;
    }
330607
protected function matchFilters($params)
    {
        foreach ($this->filters as $key => $expression) {
            if (!isset($params[$key])) {
                return false;
            }

            if (!preg_match($expression, $params[$key])) {
                return false;
            }
        }

        return true;
    }
963944
public function getChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter)
    {
        if (isset($this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter])) {
            return $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter];
        }

        return false;
    }
1001561
public function except(NodeInterface $node)
    {
        return $this->filter(function (NodeInterface $eachNode) use ($node) {
            return !$eachNode->is($node);
        });
    }