Skip to content

Commit 4428ffe

Browse files
committed
avoid short variable names
fix codacy warnings
1 parent 0a7fff5 commit 4428ffe

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/jblond/Diff/SequenceMatcher.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,19 @@ class SequenceMatcher
104104
* sequence matcher and it will perform a basic cleanup & calculate junk
105105
* elements.
106106
*
107-
* @param string|array $a A string or array containing the lines to compare against.
108-
* @param string|array $b A string or array containing the lines to compare.
107+
* @param string|array $old A string or array containing the lines to compare against.
108+
* @param string|array $new A string or array containing the lines to compare.
109109
* @param array $options
110110
* @param string|array|null $junkCallback Either an array or string that references a callback function
111111
* (if there is one) to determine 'junk' characters.
112112
*/
113-
public function __construct($a, $b, array $options, $junkCallback = null)
113+
public function __construct($old, $new, array $options, $junkCallback = null)
114114
{
115115
$this->old = array();
116116
$this->new = array();
117117
$this->junkCallback = $junkCallback;
118118
$this->setOptions($options);
119-
$this->setSequences($a, $b);
119+
$this->setSequences($old, $new);
120120
}
121121

122122
/**
@@ -234,12 +234,12 @@ private function chainB()
234234
* Checks if a particular character is in the junk dictionary
235235
* for the list of junk characters.
236236
*
237-
* @param string $b
237+
* @param string $bString
238238
* @return bool $b True if the character is considered junk. False if not.
239239
*/
240-
private function isBJunk(string $b) : bool
240+
private function isBJunk(string $bString) : bool
241241
{
242-
if (isset($this->junkDict[$b])) {
242+
if (isset($this->junkDict[$bString])) {
243243
return true;
244244
}
245245

@@ -427,7 +427,7 @@ public function getMatchingBlocks() : array
427427
}
428428
}
429429

430-
usort($matchingBlocks, array($this, 'tupleSort'));
430+
usort($matchingBlocks, function($aArray, $bArray) { return $this->tupleSort($aArray, $bArray); });
431431

432432
$i1 = 0;
433433
$j1 = 0;
@@ -694,25 +694,25 @@ private function arrayGetDefault(array $array, $key, $default)
694694
/**
695695
* Sort an array by the nested arrays it contains. Helper function for getMatchingBlocks
696696
*
697-
* @param array $a First array to compare.
698-
* @param array $b Second array to compare.
697+
* @param array $aArray First array to compare.
698+
* @param array $bArray Second array to compare.
699699
* @return int -1, 0 or 1, as expected by the usort function.
700700
*/
701-
private function tupleSort(array $a, array $b) : int
701+
private function tupleSort(array $aArray, array $bArray) : int
702702
{
703-
$max = max(count($a), count($b));
703+
$max = max(count($aArray), count($bArray));
704704
for ($counter = 0; $counter < $max; ++$counter) {
705-
if ($a[$counter] < $b[$counter]) {
705+
if ($aArray[$counter] < $bArray[$counter]) {
706706
return -1;
707-
} elseif ($a[$counter] > $b[$counter]) {
707+
} elseif ($aArray[$counter] > $bArray[$counter]) {
708708
return 1;
709709
}
710710
}
711711

712-
if (count($a) == count($b)) {
712+
if (count($aArray) == count($bArray)) {
713713
return 0;
714714
}
715-
if (count($a) < count($b)) {
715+
if (count($aArray) < count($bArray)) {
716716
return -1;
717717
}
718718
return 1;

0 commit comments

Comments
 (0)