Skip to content

Commit f1aeaad

Browse files
usmanjschroed91
authored andcommitted
second code review changes
1 parent 1a79b47 commit f1aeaad

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/Caxy/HtmlDiff/HtmlDiff.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,25 +204,20 @@ protected function processEqualOperation($operation)
204204
{
205205
$result = array();
206206
foreach ($this->newWords as $pos => $s) {
207-
$matchFound = false;
208207
if ($pos >= $operation->startInNew && $pos < $operation->endInNew) {
209-
foreach ($this->isolatedDiffTags as $isolatedDiffTag) {
210-
if ($s === $isolatedDiffTag && isset($this->newIsolatedDiffTags[$pos]) && $matchFound === false) {
211-
$oldText = implode("", $this->findMatchingScriptsInOld($operation, $pos));
212-
$newText = implode("", $this->newIsolatedDiffTags[$pos]);
213-
$result[] = $this->diffElements($oldText, $newText);
214-
$matchFound = true;
215-
}
216-
}
217-
if($matchFound === false){
208+
if (in_array($s, $this->isolatedDiffTags) && isset($this->newIsolatedDiffTags[$pos])) {
209+
$oldText = implode("", $this->findIsolatedDiffTagsInOld($operation, $pos));
210+
$newText = implode("", $this->newIsolatedDiffTags[$pos]);
211+
$result[] = $this->diffElements($oldText, $newText);
212+
} else {
218213
$result[] = $s;
219214
}
220215
}
221216
}
222217
$this->content .= implode( "", $result );
223218
}
224219

225-
private function findMatchingScriptsInOld($operation, $posInNew)
220+
private function findIsolatedDiffTagsInOld($operation, $posInNew)
226221
{
227222
$offset = $posInNew - $operation->startInNew;
228223

0 commit comments

Comments
 (0)