Code Duplication    Length = 7-8 lines in 2 locations

src/Rules/Relation.php 1 location

@@ 68-75 (lines=8) @@
65
            return [$query
66
                ->filter($filter_left)
67
                ->expand_relations([$this->name()])
68
                ->extract(function($e,&$r) use ($rule) {
69
                    $file = $e->property("file");
70
                    assert('$file->type() == "file"');
71
                    $r["file"] = $file->property("path");
72
                    $line = $e->property("line");
73
                    $r["line"] = $line;
74
                    $r["source"] = $file->property("source")[$line - 1];
75
                })
76
                ->expand_target()
77
                ->filter($filter_right)]
78
                ;

src/Rules/ContainText.php 1 location

@@ 108-114 (lines=7) @@
105
                    ->filter($filter_non_files)
106
                    ->expand_relations(["defined in"])
107
                    ->filter($this->regexp_source_filter($pred_factory, $regexp, true))
108
                    ->extract(function($e,&$r) use ($rule) {
109
                        $file = $e->target();
110
                        $r["file"] = $file->property("path");
111
                        $line = $e->property("start_line");
112
                        $r["line"] = $line;
113
                        $r["source"] = $file->property("source")[$line - 1];
114
                    })
115
                // TODO: add implementation for files here.
116
                ];
117
        }