@@ -14,7 +14,7 @@ final class Line extends AbstractLineRenderer
1414 */
1515 public function render (MbString $ mbFrom , MbString $ mbTo ): LineRendererInterface
1616 {
17- [$ start , $ end ] = $ this ->getChangedExtentBeginEnd ($ mbFrom , $ mbTo );
17+ [$ start , $ end ] = $ this ->getChangedExtentRegion ($ mbFrom , $ mbTo );
1818
1919 // two strings are the same
2020 if ($ end === 0 ) {
@@ -46,7 +46,7 @@ public function render(MbString $mbFrom, MbString $mbTo): LineRendererInterface
4646 * @return array Array containing the starting position (non-negative) and the ending position (negative)
4747 * [0, 0] if two strings are the same
4848 */
49- protected function getChangedExtentBeginEnd (MbString $ mbFrom , MbString $ mbTo ): array
49+ protected function getChangedExtentRegion (MbString $ mbFrom , MbString $ mbTo ): array
5050 {
5151 // two strings are the same
5252 // most lines should be this cases, an early return could save many function calls
@@ -56,19 +56,19 @@ protected function getChangedExtentBeginEnd(MbString $mbFrom, MbString $mbTo): a
5656
5757 // calculate $start
5858 $ start = 0 ;
59- $ startLimit = \min ($ mbFrom ->strlen (), $ mbTo ->strlen ());
59+ $ startMax = \min ($ mbFrom ->strlen (), $ mbTo ->strlen ());
6060 while (
61- $ start < $ startLimit && // index out of range
61+ $ start < $ startMax && // index out of range
6262 $ mbFrom ->getAtRaw ($ start ) === $ mbTo ->getAtRaw ($ start )
6363 ) {
6464 ++$ start ;
6565 }
6666
6767 // calculate $end
6868 $ end = -1 ; // trick
69- $ endLimit = $ startLimit - $ start ;
69+ $ endMin = $ startMax - $ start ;
7070 while (
71- -$ end <= $ endLimit && // index out of range
71+ -$ end <= $ endMin && // index out of range
7272 $ mbFrom ->getAtRaw ($ end ) === $ mbTo ->getAtRaw ($ end )
7373 ) {
7474 --$ end ;
0 commit comments