@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $sequence2 = $string2; |
44 | 44 | $end1 = strlen($string1) - 1; |
45 | 45 | $end2 = strlen($string2) - 1; |
46 | - }else{ |
|
46 | + } else{ |
|
47 | 47 | $sequence1 = preg_split('/\R/', $string1); |
48 | 48 | $sequence2 = preg_split('/\R/', $string2); |
49 | 49 | $end1 = count($sequence1) - 1; |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | for ($index = 0; $index < $start; $index ++){ |
76 | 76 | $diff[] = array($sequence1[$index], self::UNMODIFIED); |
77 | 77 | } |
78 | - while (count($partialDiff) > 0) $diff[] = array_pop($partialDiff); |
|
78 | + while (count($partialDiff) > 0) { |
|
79 | + $diff[] = array_pop($partialDiff); |
|
80 | + } |
|
79 | 81 | for ($index = $end1 + 1; |
80 | 82 | $index < ($compareCharacters ? strlen($sequence1) : count($sequence1)); |
81 | 83 | $index ++){ |
@@ -137,7 +139,7 @@ discard block |
||
137 | 139 | if ($sequence1[$index1 + $start - 1] |
138 | 140 | == $sequence2[$index2 + $start - 1]){ |
139 | 141 | $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1; |
140 | - }else{ |
|
142 | + } else{ |
|
141 | 143 | $table[$index1][$index2] = |
142 | 144 | max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]); |
143 | 145 | } |
@@ -181,14 +183,14 @@ discard block |
||
181 | 183 | $index1 --; |
182 | 184 | $index2 --; |
183 | 185 | |
184 | - }elseif ($index2 > 0 |
|
186 | + } elseif ($index2 > 0 |
|
185 | 187 | && $table[$index1][$index2] == $table[$index1][$index2 - 1]){ |
186 | 188 | |
187 | 189 | // update the diff and the indices |
188 | 190 | $diff[] = array($sequence2[$index2 + $start - 1], self::INSERTED); |
189 | 191 | $index2 --; |
190 | 192 | |
191 | - }else{ |
|
193 | + } else{ |
|
192 | 194 | |
193 | 195 | // update the diff and the indices |
194 | 196 | $diff[] = array($sequence1[$index1 + $start - 1], self::DELETED); |
@@ -28,8 +28,12 @@ |
||
28 | 28 | $input = ''; |
29 | 29 | } else { |
30 | 30 | $pos = strpos($input, '/'); |
31 | - if ($pos === 0) $pos = strpos($input, '/', $pos+1); |
|
32 | - if ($pos === false) $pos = strlen($input); |
|
31 | + if ($pos === 0) { |
|
32 | + $pos = strpos($input, '/', $pos+1); |
|
33 | + } |
|
34 | + if ($pos === false) { |
|
35 | + $pos = strlen($input); |
|
36 | + } |
|
33 | 37 | $output .= substr($input, 0, $pos); |
34 | 38 | $input = (string) substr($input, $pos); |
35 | 39 | } |