@@ -158,7 +158,7 @@ protected function createIsolatedDiffTagPlaceholders(&$words)
158158 foreach ($ words as $ index => $ word ) {
159159 $ openIsolatedDiffTag = $ this ->isOpeningIsolatedDiffTag ($ word , $ currentIsolatedDiffTag );
160160 if ($ openIsolatedDiffTag ) {
161- if ($ this ->isSelfClosingTag ($ word ) || mb_stripos ($ word , '<img ' ) !== false ) {
161+ if ($ this ->isSelfClosingTag ($ word ) || $ this -> stringUtil -> stripos ($ word , '<img ' ) !== false ) {
162162 if ($ openIsolatedDiffTags === 0 ) {
163163 $ isolatedDiffTagIndices [] = array (
164164 'start ' => $ index ,
@@ -543,7 +543,7 @@ protected function insertTag($tag, $cssClass, &$words)
543543 $ specialCaseTagInjection = '' ;
544544 $ specialCaseTagInjectionIsBefore = false ;
545545
546- if (count ($ nonTags ) != 0 ) {
546+ if (count ($ nonTags ) !== 0 ) {
547547 $ text = $ this ->wrapText (implode ('' , $ nonTags ), $ tag , $ cssClass );
548548 $ this ->content .= $ text ;
549549 } else {
@@ -567,15 +567,15 @@ protected function insertTag($tag, $cssClass, &$words)
567567 }
568568 }
569569 }
570- if (count ($ words ) == 0 && mb_strlen ($ specialCaseTagInjection ) == 0 ) {
570+ if (count ($ words ) == 0 && $ this -> stringUtil -> strlen ($ specialCaseTagInjection ) == 0 ) {
571571 break ;
572572 }
573573 if ($ specialCaseTagInjectionIsBefore ) {
574574 $ this ->content .= $ specialCaseTagInjection .implode ('' , $ this ->extractConsecutiveWords ($ words , 'tag ' ));
575575 } else {
576576 $ workTag = $ this ->extractConsecutiveWords ($ words , 'tag ' );
577577 if (isset ($ workTag [ 0 ]) && $ this ->isOpeningTag ($ workTag [ 0 ]) && !$ this ->isClosingTag ($ workTag [ 0 ])) {
578- if (mb_strpos ($ workTag [ 0 ], 'class= ' )) {
578+ if ($ this -> stringUtil -> strpos ($ workTag [ 0 ], 'class= ' )) {
579579 $ workTag [ 0 ] = str_replace ('class=" ' , 'class="diffmod ' , $ workTag [ 0 ]);
580580 $ workTag [ 0 ] = str_replace ("class=' " , 'class="diffmod ' , $ workTag [ 0 ]);
581581 } else {
@@ -584,7 +584,7 @@ protected function insertTag($tag, $cssClass, &$words)
584584 }
585585
586586 $ appendContent = implode ('' , $ workTag ).$ specialCaseTagInjection ;
587- if (isset ($ workTag [0 ]) && false !== mb_stripos ($ workTag [0 ], '<img ' )) {
587+ if (isset ($ workTag [0 ]) && false !== $ this -> stringUtil -> stripos ($ workTag [0 ], '<img ' )) {
588588 $ appendContent = $ this ->wrapText ($ appendContent , $ tag , $ cssClass );
589589 }
590590 $ this ->content .= $ appendContent ;
@@ -698,7 +698,7 @@ protected function operations()
698698 $ matches = $ this ->matchingBlocks ();
699699 $ matches [] = new Match (count ($ this ->oldWords ), count ($ this ->newWords ), 0 );
700700
701- foreach ($ matches as $ i => $ match ) {
701+ foreach ($ matches as $ match ) {
702702 $ matchStartsAtCurrentPositionInOld = ($ positionInOld === $ match ->startInOld );
703703 $ matchStartsAtCurrentPositionInNew = ($ positionInNew === $ match ->startInNew );
704704
@@ -769,10 +769,10 @@ protected function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endI
769769 */
770770 protected function stripTagAttributes ($ word )
771771 {
772- $ space = mb_strpos ($ word , ' ' , 1 );
772+ $ space = $ this -> stringUtil -> strpos ($ word , ' ' , 1 );
773773
774774 if ($ space ) {
775- return '< ' . mb_substr ($ word , 1 , $ space ) . '> ' ;
775+ return '< ' . $ this -> stringUtil -> substr ($ word , 1 , $ space ) . '> ' ;
776776 }
777777
778778 return trim ($ word , '<> ' );
@@ -788,6 +788,7 @@ protected function stripTagAttributes($word)
788788 */
789789 protected function findMatch ($ startInOld , $ endInOld , $ startInNew , $ endInNew )
790790 {
791+ $ groupDiffs = $ this ->isGroupDiffs ();
791792 $ bestMatchInOld = $ startInOld ;
792793 $ bestMatchInNew = $ startInNew ;
793794 $ bestMatchSize = 0 ;
@@ -816,7 +817,7 @@ protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
816817
817818 if ($ newMatchLength > $ bestMatchSize ||
818819 (
819- $ this -> isGroupDiffs () &&
820+ $ groupDiffs &&
820821 $ bestMatchSize > 0 &&
821822 $ this ->isOnlyWhitespace ($ this ->array_slice_cached ($ this ->oldWords , $ bestMatchInOld , $ bestMatchSize ))
822823 )
@@ -830,9 +831,9 @@ protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
830831 }
831832
832833 // Skip match if none found or match consists only of whitespace
833- if ($ bestMatchSize != 0 &&
834+ if ($ bestMatchSize !== 0 &&
834835 (
835- !$ this -> isGroupDiffs () ||
836+ !$ groupDiffs ||
836837 !$ this ->isOnlyWhitespace ($ this ->array_slice_cached ($ this ->oldWords , $ bestMatchInOld , $ bestMatchSize ))
837838 )
838839 ) {
@@ -850,7 +851,7 @@ protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
850851 protected function isOnlyWhitespace ($ str )
851852 {
852853 // Slightly faster then using preg_match
853- return $ str !== '' && ( mb_strlen ( trim ($ str )) === 0 ) ;
854+ return $ str !== '' && trim ($ str ) === '' ;
854855 }
855856
856857 /**
0 commit comments