1 call to JSqueeze::rsort()
JSqueeze::renameVars dans advagg_js_compress/jsqueeze.inc

Fichier

advagg_js_compress/jsqueeze.inc, line 1114

Classe

JSqueeze

Namespace

Patchwork

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;
}