private function JSqueeze::rsort in Minify JS 7
1 call to JSqueeze::rsort()
- JSqueeze::renameVars in lib/
JSqueeze.php
File
- lib/
JSqueeze.php, line 1028
Class
Code
private function rsort($array) {
if (!$array) {
return $array;
}
$i = 0;
$tuples = array();
foreach ($array as $k => &$v) {
$tuples[] = array(
++$i,
$k,
&$v,
);
}
usort($tuples, function ($a, $b) {
if ($b[2] > $a[2]) {
return 1;
}
if ($b[2] < $a[2]) {
return -1;
}
if ($b[0] > $a[0]) {
return -1;
}
if ($b[0] < $a[0]) {
return 1;
}
return 0;
});
$array = array();
foreach ($tuples as $t) {
$array[$t[1]] =& $t[2];
}
return $array;
}