Skip to content

Commit 87edbec

Browse files
committed
shorten code
1 parent 62b01c5 commit 87edbec

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

lib/jblond/Diff/SequenceMatcher.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ public function getGroupedOpcodes($context=3)
586586
$maxRange = $context * 2;
587587
$groups = array();
588588
$group = array();
589+
589590
foreach($opCodes as $code) {
590591
list($tag, $i1, $i2, $j1, $j2) = $code;
591592
if($tag == 'equal' && $i2 - $i1 > $maxRange) {
@@ -661,9 +662,7 @@ private function calculateRatio($matches, $length=0)
661662
if($length) {
662663
return 2 * ($matches / $length);
663664
}
664-
else {
665-
return 1;
666-
}
665+
return 1;
667666
}
668667

669668
/**
@@ -681,9 +680,7 @@ private function arrayGetDefault($array, $key, $default)
681680
if(isset($array[$key])) {
682681
return $array[$key];
683682
}
684-
else {
685-
return $default;
686-
}
683+
return $default;
687684
}
688685

689686
/**
@@ -708,11 +705,9 @@ private function tupleSort($a, $b)
708705
if(count($a) == count($b)) {
709706
return 0;
710707
}
711-
else if(count($a) < count($b)) {
708+
if(count($a) < count($b)) {
712709
return -1;
713710
}
714-
else {
715-
return 1;
716-
}
711+
return 1;
717712
}
718713
}

0 commit comments

Comments
 (0)