@@ -11,7 +11,7 @@ class HtmlDiff extends AbstractDiff
1111 protected $ isolatedDiffTags = array ('ol ' => '[[REPLACE_ORDERED_LIST]] ' , 'ul ' => '[[REPLACE_UNORDERED_LIST]] ' , 'sub ' => '[[REPLACE_SUB_SCRIPT]] ' , 'sup ' => '[[REPLACE_SUPER_SCRIPT]] ' , 'dl ' => '[[REPLACE_DEFINITION_LIST]] ' , 'table ' => '[[REPLACE_TABLE]] ' );
1212
1313 /**
14- * @param boolean $boolean
14+ * @param boolean $boolean
1515 * @return HtmlDiff
1616 */
1717 public function setInsertSpaceInReplace ($ boolean )
@@ -34,7 +34,7 @@ public function build()
3434 $ this ->splitInputsToWords ();
3535 $ this ->replaceIsolatedDiffTags ();
3636 $ this ->indexNewWords ();
37-
37+
3838 $ operations = $ this ->operations ();
3939 foreach ($ operations as $ item ) {
4040 $ this ->performOperation ( $ item );
@@ -78,9 +78,9 @@ protected function createIsolatedDiffTagPlaceholders(&$words)
7878 }
7979 $ openIsolatedDiffTags ++;
8080 $ currentIsolatedDiffTag = $ openIsolatedDiffTag ;
81- } elseif ($ openIsolatedDiffTags > 0 && $ this ->isClosingIsolatedDiffTag ($ word , $ currentIsolatedDiffTag )) {
81+ } elseif ($ openIsolatedDiffTags > 0 && $ this ->isClosingIsolatedDiffTag ($ word , $ currentIsolatedDiffTag )) {
8282 $ openIsolatedDiffTags --;
83- if ($ openIsolatedDiffTags == 0 ){
83+ if ($ openIsolatedDiffTags == 0 ) {
8484 $ isolatedDiffTagIndicies [] = array ('start ' => $ isolatedDiffTagStart , 'length ' => $ index - $ isolatedDiffTagStart + 1 , 'tagType ' => $ currentIsolatedDiffTag );
8585 $ currentIsolatedDiffTag = null ;
8686 }
@@ -107,17 +107,19 @@ protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = nul
107107 return $ key ;
108108 }
109109 }
110+
110111 return false ;
111112 }
112113
113114 protected function isClosingIsolatedDiffTag ($ item , $ currentIsolatedDiffTag = null )
114115 {
115116 $ tagsToMatch = $ currentIsolatedDiffTag !== null ? array ($ currentIsolatedDiffTag => $ this ->isolatedDiffTags [$ currentIsolatedDiffTag ]) : $ this ->isolatedDiffTags ;
116117 foreach ($ tagsToMatch as $ key => $ value ) {
117- if (preg_match ("#</ " .$ key ."[^>]*> \\s*#iU " , $ item )) {
118+ if (preg_match ("#</ " .$ key ."[^>]*> \\s*#iU " , $ item )) {
118119 return $ key ;
119120 }
120121 }
122+
121123 return false ;
122124 }
123125
@@ -152,7 +154,7 @@ protected function processInsertOperation($operation, $cssClass)
152154 $ text = array ();
153155 foreach ($ this ->newWords as $ pos => $ s ) {
154156 if ($ pos >= $ operation ->startInNew && $ pos < $ operation ->endInNew ) {
155- if (in_array ($ s , $ this ->isolatedDiffTags ) && isset ($ this ->newIsolatedDiffTags [$ pos ])) {
157+ if (in_array ($ s , $ this ->isolatedDiffTags ) && isset ($ this ->newIsolatedDiffTags [$ pos ])) {
156158 foreach ($ this ->newIsolatedDiffTags [$ pos ] as $ word ) {
157159 $ text [] = $ word ;
158160 }
@@ -195,6 +197,7 @@ protected function diffElements($oldText, $newText)
195197 $ newText = preg_replace ($ pattern , '' , $ newText );
196198
197199 $ diff = new HtmlDiff ($ oldText , $ newText , $ this ->encoding , $ this ->isolatedDiffTags , $ this ->groupDiffs );
200+
198201 return $ wrapStart . $ diff ->build () . $ wrapEnd ;
199202 }
200203
0 commit comments