| @@ 30-52 (lines=23) @@ | ||
| 27 | return $diff; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function build() |
|
| 31 | { |
|
| 32 | $this->prepare(); |
|
| 33 | ||
| 34 | if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) { |
|
| 35 | $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText); |
|
| 36 | ||
| 37 | return $this->content; |
|
| 38 | } |
|
| 39 | ||
| 40 | $this->splitInputsToWords(); |
|
| 41 | ||
| 42 | $this->content = $this->diffLists( |
|
| 43 | $this->buildDiffList($this->oldWords), |
|
| 44 | $this->buildDiffList($this->newWords) |
|
| 45 | ); |
|
| 46 | ||
| 47 | if ($this->hasDiffCache()) { |
|
| 48 | $this->getDiffCache()->save($this->oldText, $this->newText, $this->content); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->content; |
|
| 52 | } |
|
| 53 | ||
| 54 | protected function diffLists(DiffList $oldList, DiffList $newList) |
|
| 55 | { |
|
| @@ 90-113 (lines=24) @@ | ||
| 87 | /** |
|
| 88 | * @return string |
|
| 89 | */ |
|
| 90 | public function build() |
|
| 91 | { |
|
| 92 | $this->prepare(); |
|
| 93 | ||
| 94 | if ($this->hasDiffCache() && $this->getDiffCache()->contains($this->oldText, $this->newText)) { |
|
| 95 | $this->content = $this->getDiffCache()->fetch($this->oldText, $this->newText); |
|
| 96 | ||
| 97 | return $this->content; |
|
| 98 | } |
|
| 99 | ||
| 100 | $this->buildTableDoms(); |
|
| 101 | ||
| 102 | $this->diffDom = new \DOMDocument(); |
|
| 103 | ||
| 104 | $this->indexCellValues($this->newTable); |
|
| 105 | ||
| 106 | $this->diffTableContent(); |
|
| 107 | ||
| 108 | if ($this->hasDiffCache()) { |
|
| 109 | $this->getDiffCache()->save($this->oldText, $this->newText, $this->content); |
|
| 110 | } |
|
| 111 | ||
| 112 | return $this->content; |
|
| 113 | } |
|
| 114 | ||
| 115 | protected function diffTableContent() |
|
| 116 | { |
|