Code Duplication    Length = 10-10 lines in 2 locations

src/Graph/QueryImpl.php 2 locations

@@ 130-139 (lines=10) @@
127
    /**
128
     * @return  Iterator <[Node,mixed]>
129
     */
130
    protected function run_expand(\Iterator $nodes, \Closure $clsr) {
131
        while ($nodes->valid()) {
132
            list($node, $result) = $nodes->current();
133
            // TODO: let closure return an Iterator too.
134
            foreach($clsr($node) as $new_node) {
135
                yield [$new_node, $result];
136
            }
137
            $nodes->next();
138
        }
139
    }
140
141
    /**
142
     * @return  Iterator <[Node,mixed]>
@@ 159-168 (lines=10) @@
156
    /**
157
     * @return  Iterator <[Node,mixed]>
158
     */
159
    protected function run_filter(\Iterator $nodes, \Closure $predicate) {
160
        while ($nodes->valid()) {
161
            $val = $nodes->current();
162
            list($node, $result) = $val;
163
            if ($predicate($node, $result)) {
164
                yield $val;
165
            }
166
            $nodes->next();
167
        }
168
    }
169
170
    /**
171
     * @return  Iterator <[Node,mixed]>