src/PHPHtmlParser/Selector/Selector.php
public function find(AbstractNode $node): Collection
    {
        $results = new Collection;
        foreach ($this->selectors as $selector) {
            $nodes = [$node];
            if (count($selector) == 0) {
                continue;
            }

            $options = [];
            foreach ($selector as $rule) {
                if ($rule['alterNext']) {
                    $options[] = $this->alterNext($rule);
                    continue;
                }
                $nodes = $this->seek($nodes, $rule, $options);
                // clear the options
                $options = [];
            }

            // this is the final set of nodes
            foreach ($nodes as $result) {
                $results[] = $result;
            }
        }

        return $results;
    }
public function find(AbstractNode $node): Collection
    {
        $results = new Collection;
        foreach ($this->selectors as $selector) {
            $nodes = [$node];
            if (count($selector) == 0) {
                continue;
            }

            $options = [];
            foreach ($selector as $rule) {
                if ($rule['alterNext']) {
                    $options[] = $this->alterNext($rule);
                    continue;
                }
                $nodes = $this->seek($nodes, $rule, $options);
                // clear the options
                $options = [];
            }

            // this is the final set of nodes
            foreach ($nodes as $result) {
                $results[] = $result;
            }
        }

        return $results;
    }
public function find ( AbstractNode $ node ) : Collection { $ results = new Collection ; foreach ( $ this -> selectors as $ selector ) { $ nodes = [ $ node ] ; if ( count ( $ selector ) == 0 ) { continue ; } $ options = [ ] ; foreach ( $ selector as $ rule ) { if ( $ rule [ 'alterNext' ] ) { $ options [ ] = $ this -> alterNext ( $ rule ) ; continue ; } $ nodes = $ this -> seek ( $ nodes , $ rule , $ options ) ; // clear the options $ options = [ ] ; } // this is the final set of nodes foreach ( $ nodes as $ result ) { $ results [ ] = $ result ; } } return $ results ; }
Attempts to find the selectors starting from the given
node object.

@param AbstractNode $node
@return Collection
Attempts to find the selectors starting from the given node object .