Matches example

/** * Returns true if the selector part matches the given node, * false otherwise * * @param Node $node Node * @param Node $parent Parent node * * @return bool */
    public function check(Node $node, Node $parent = null)
    {
        $match = new Matches();
        $match->addMatch($node$parent);
        $res = $this->selector->exec($match)->count();
        return $this->name === "not" ? $res === 0 : $res !== 0;
    }
}
/** * Class constructor. Available options are: * - encoding: selectors encoding. If not specified the * parser will assume UTF-8. * * @param Syntax\Node\Program $root Root node * @param array $options Options array */
    public function __construct(Syntax\Node\Program $root$options = array())
    {
        $this->matches = new Selector\Matches();
        $this->matches->addMatch($root);
        $this->options = $options;
    }

    /** * Finds nodes matching the given selector starting from the * current matched nodes, if any, or from the root * * @param string $selector Selector * * @return $this * * @throws Selector\Exception */
Home | Imprint | This part of the site doesn't use cookies.