public function reduce(\Closure $closure)
    {
        $nodes = [];
        foreach ($this->nodes as $i => $node) {
            if (false !== $closure($this->createSubCrawler($node), $i)) {
                $nodes[] = $node;
            }
        }

        return $this->createSubCrawler($nodes);
    }
public function reduce(\Closure $closure)
    {
        $nodes = [];
        foreach ($this->nodes as $i => $node) {
            if (false !== $closure($this->createSubCrawler($node), $i)) {
                $nodes[] = $node;
            }
        }

        return $this->createSubCrawler($nodes);
    }
public function reduce ( \ Closure $ closure ) { $ nodes = [ ] ; foreach ( $ this -> nodes as $ i => $ node ) { if ( false !== $ closure ( $ this -> createSubCrawler ( $ node ) , $ i ) ) { $ nodes [ ] = $ node ; } } return $ this -> createSubCrawler ( $ nodes ) ; }
Reduces the list of nodes by calling an anonymous function.

To remove a node from the list, the anonymous function must return false.

@param \Closure $closure An anonymous function

@return self
Reduces the list of nodes by calling an anonymous function .