Code Duplication    Length = 8-8 lines in 2 locations

src/Graph/QueryImpl.php 2 locations

@@ 122-129 (lines=8) @@
119
     * @return  Iterator <[Node,mixed]>
120
     */
121
    protected function run_expand(\Iterator $nodes, \Closure $clsr) {
122
        while ($nodes->valid()) {
123
            list($node, $result) = $nodes->current();
124
            // TODO: let closure return an Iterator too.
125
            foreach($clsr($node) as $new_node) {
126
                yield [$new_node, $result];
127
            }
128
            $nodes->next();
129
        }
130
    }
131
132
    /**
@@ 152-159 (lines=8) @@
149
     */
150
    protected function run_filter(\Iterator $nodes, Predicate $predicate) {
151
        $clsr = $predicate->compile();
152
        while ($nodes->valid()) {
153
            $val = $nodes->current();
154
            list($node, $result) = $val;
155
            if ($clsr($node, $result)) {
156
                yield $val;
157
            }
158
            $nodes->next();
159
        }
160
    }
161
162
    /**