Code Duplication    Length = 8-8 lines in 2 locations

src/Graph/QueryImpl.php 2 locations

@@ 117-124 (lines=8) @@
114
     * @return  Iterator<[Node,mixed]>
115
     */
116
    protected function run_expand(\Iterator $nodes, \Closure $clsr) {
117
        while ($nodes->valid()) {
118
            list($node, $result) = $nodes->current();
119
            // TODO: let closure return an Iterator too.
120
            foreach($clsr($node) as $new_node) {
121
                yield [$new_node, $result];
122
            }
123
            $nodes->next();
124
        }
125
    }
126
127
    /**
@@ 147-154 (lines=8) @@
144
     */
145
    protected function run_filter(\Iterator $nodes, Predicate $predicate) {
146
        $clsr = $predicate->compile();
147
        while ($nodes->valid()) {
148
            $val = $nodes->current();
149
            list($node, $result) = $val;
150
            if ($clsr($node, $result)) {
151
                yield $val;
152
            }
153
            $nodes->next();
154
        }
155
    }
156
157
    /**