@@ -14,7 +14,7 @@ final class Line extends AbstractLineRenderer
14
14
*/
15
15
public function render (MbString $ mbFrom , MbString $ mbTo ): LineRendererInterface
16
16
{
17
- [$ start , $ end ] = $ this ->getChangedExtentBeginEnd ($ mbFrom , $ mbTo );
17
+ [$ start , $ end ] = $ this ->getChangedExtentRegion ($ mbFrom , $ mbTo );
18
18
19
19
// two strings are the same
20
20
if ($ end === 0 ) {
@@ -46,7 +46,7 @@ public function render(MbString $mbFrom, MbString $mbTo): LineRendererInterface
46
46
* @return array Array containing the starting position (non-negative) and the ending position (negative)
47
47
* [0, 0] if two strings are the same
48
48
*/
49
- protected function getChangedExtentBeginEnd (MbString $ mbFrom , MbString $ mbTo ): array
49
+ protected function getChangedExtentRegion (MbString $ mbFrom , MbString $ mbTo ): array
50
50
{
51
51
// two strings are the same
52
52
// 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
56
56
57
57
// calculate $start
58
58
$ start = 0 ;
59
- $ startLimit = \min ($ mbFrom ->strlen (), $ mbTo ->strlen ());
59
+ $ startMax = \min ($ mbFrom ->strlen (), $ mbTo ->strlen ());
60
60
while (
61
- $ start < $ startLimit && // index out of range
61
+ $ start < $ startMax && // index out of range
62
62
$ mbFrom ->getAtRaw ($ start ) === $ mbTo ->getAtRaw ($ start )
63
63
) {
64
64
++$ start ;
65
65
}
66
66
67
67
// calculate $end
68
68
$ end = -1 ; // trick
69
- $ endLimit = $ startLimit - $ start ;
69
+ $ endMin = $ startMax - $ start ;
70
70
while (
71
- -$ end <= $ endLimit && // index out of range
71
+ -$ end <= $ endMin && // index out of range
72
72
$ mbFrom ->getAtRaw ($ end ) === $ mbTo ->getAtRaw ($ end )
73
73
) {
74
74
--$ end ;
0 commit comments