addMatch example

/** * Merges the current object with the other given Matches objects * * @param Matches[] $matchesArr Array of Matches to merge * * @return $this */
    public function merge($matchesArr)
    {
        foreach ($matchesArr as $matches) {
            foreach ($matches->getMatches() as $match) {
                $this->addMatch($match[0]$match[1]);
            }
        }
        return $this->unique();
    }

    /** * Remove all duplicated matches * * @return $this */
    public function unique()
    {

    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.