Code Duplication    Length = 21-22 lines in 2 locations

lib/Caxy/HtmlDiff/Table/TableDiff.php 1 location

@@ 116-137 (lines=22) @@
113
    /**
114
     * @return string
115
     */
116
    public function build()
117
    {
118
        if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) {
119
            $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText);
120
121
            return $this->content;
122
        }
123
124
        $this->buildTableDoms();
125
126
        $this->diffDom = new \DOMDocument();
127
128
        $this->indexCellValues($this->newTable);
129
130
        $this->diffTableContent();
131
132
        if ($this->hasDiffCache()) {
133
            $this->getDiffCache()->save($this->oldText, $this->newText, $this->content);
134
        }
135
136
        return $this->content;
137
    }
138
139
    protected function diffTableContent()
140
    {

lib/Caxy/HtmlDiff/ListDiff.php 1 location

@@ 30-50 (lines=21) @@
27
        return $diff;
28
    }
29
30
    public function build()
31
    {
32
        if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) {
33
            $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText);
34
35
            return $this->content;
36
        }
37
38
        $this->splitInputsToWords();
39
40
        $this->content = $this->diffLists(
41
            $this->buildDiffList($this->oldWords),
42
            $this->buildDiffList($this->newWords)
43
        );
44
45
        if ($this->hasDiffCache()) {
46
            $this->getDiffCache()->save($this->oldText, $this->newText, $this->content);
47
        }
48
49
        return $this->content;
50
    }
51
52
    protected function diffLists(DiffList $oldList, DiffList $newList)
53
    {