@@ -53,12 +53,12 @@ class SequenceMatcher
53
53
/**
54
54
* @var array The first sequence to compare against.
55
55
*/
56
- private $ a = array ();
56
+ private $ old = array ();
57
57
58
58
/**
59
59
* @var array The second sequence.
60
60
*/
61
- private $ b = array ();
61
+ private $ new = array ();
62
62
63
63
/**
64
64
* @var array Array of characters that are considered junk from the second sequence. Characters are the array key.
@@ -112,8 +112,8 @@ class SequenceMatcher
112
112
*/
113
113
public function __construct ($ a , $ b , array $ options , $ junkCallback = null )
114
114
{
115
- $ this ->a = array ();
116
- $ this ->b = array ();
115
+ $ this ->old = array ();
116
+ $ this ->new = array ();
117
117
$ this ->junkCallback = $ junkCallback ;
118
118
$ this ->setOptions ($ options );
119
119
$ this ->setSequences ($ a , $ b );
@@ -150,11 +150,11 @@ public function setSeq1($partA)
150
150
if (!is_array ($ partA )) {
151
151
$ partA = str_split ($ partA );
152
152
}
153
- if ($ partA == $ this ->a ) {
153
+ if ($ partA == $ this ->old ) {
154
154
return ;
155
155
}
156
156
157
- $ this ->a = $ partA ;
157
+ $ this ->old = $ partA ;
158
158
$ this ->matchingBlocks = null ;
159
159
$ this ->opCodes = null ;
160
160
}
@@ -170,11 +170,11 @@ public function setSeq2($partB)
170
170
if (!is_array ($ partB )) {
171
171
$ partB = str_split ($ partB );
172
172
}
173
- if ($ partB == $ this ->b ) {
173
+ if ($ partB == $ this ->new ) {
174
174
return ;
175
175
}
176
176
177
- $ this ->b = $ partB ;
177
+ $ this ->new = $ partB ;
178
178
$ this ->matchingBlocks = null ;
179
179
$ this ->opCodes = null ;
180
180
$ this ->fullBCount = null ;
@@ -187,12 +187,12 @@ public function setSeq2($partB)
187
187
*/
188
188
private function chainB ()
189
189
{
190
- $ length = count ($ this ->b );
190
+ $ length = count ($ this ->new );
191
191
$ this ->b2j = array ();
192
192
$ popularDict = array ();
193
193
194
194
for ($ i = 0 ; $ i < $ length ; ++$ i ) {
195
- $ char = $ this ->b [$ i ];
195
+ $ char = $ this ->new [$ i ];
196
196
if (isset ($ this ->b2j [$ char ])) {
197
197
if ($ length >= 200 && count ($ this ->b2j [$ char ]) * 100 > $ length ) {
198
198
$ popularDict [$ char ] = 1 ;
@@ -268,8 +268,8 @@ private function isBJunk(string $b) : bool
268
268
*/
269
269
public function findLongestMatch (int $ alo , int $ ahi , int $ blo , int $ bhi ) : array
270
270
{
271
- $ a = $ this ->a ;
272
- $ b = $ this ->b ;
271
+ $ a = $ this ->old ;
272
+ $ b = $ this ->new ;
273
273
274
274
$ bestI = $ alo ;
275
275
$ bestJ = $ blo ;
@@ -351,8 +351,8 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi) : array
351
351
*/
352
352
public function linesAreDifferent (int $ aIndex , int $ bIndex ) : bool
353
353
{
354
- $ lineA = $ this ->a [$ aIndex ];
355
- $ lineB = $ this ->b [$ bIndex ];
354
+ $ lineA = $ this ->old [$ aIndex ];
355
+ $ lineB = $ this ->new [$ bIndex ];
356
356
357
357
if ($ this ->options ['ignoreWhitespace ' ]) {
358
358
$ replace = array ("\t" , ' ' );
@@ -388,8 +388,8 @@ public function getMatchingBlocks() : array
388
388
return $ this ->matchingBlocks ;
389
389
}
390
390
391
- $ aLength = count ($ this ->a );
392
- $ bLength = count ($ this ->b );
391
+ $ aLength = count ($ this ->old );
392
+ $ bLength = count ($ this ->new );
393
393
394
394
$ queue = array (
395
395
array (
@@ -642,7 +642,7 @@ public function getGroupedOpcodes(int $context = 3) : array
642
642
public function ratio () : float
643
643
{
644
644
$ matches = array_reduce ($ this ->getMatchingBlocks (), function ($ sum , $ triple ){ return $ this ->ratioReduce ($ sum , $ triple ); }, 0 );
645
- return $ this ->calculateRatio ($ matches , count ($ this ->a ) + count ($ this ->b ));
645
+ return $ this ->calculateRatio ($ matches , count ($ this ->old ) + count ($ this ->new ));
646
646
}
647
647
648
648
/**
0 commit comments