| @@ 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 | { |
|
| @@ 93-114 (lines=22) @@ | ||
| 90 | /** |
|
| 91 | * @return string |
|
| 92 | */ |
|
| 93 | public function build() |
|
| 94 | { |
|
| 95 | if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) { |
|
| 96 | $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText); |
|
| 97 | ||
| 98 | return $this->content; |
|
| 99 | } |
|
| 100 | ||
| 101 | $this->buildTableDoms(); |
|
| 102 | ||
| 103 | $this->diffDom = new \DOMDocument(); |
|
| 104 | ||
| 105 | $this->indexCellValues($this->newTable); |
|
| 106 | ||
| 107 | $this->diffTableContent(); |
|
| 108 | ||
| 109 | if ($this->hasDiffCache()) { |
|
| 110 | $this->getDiffCache()->save($this->oldText, $this->newText, $this->content); |
|
| 111 | } |
|
| 112 | ||
| 113 | return $this->content; |
|
| 114 | } |
|
| 115 | ||
| 116 | protected function diffTableContent() |
|
| 117 | { |
|