S3Browser::sort PHP Method

sort() private static method

Sort with dirs first, then alphabetical ascending
private static sort ( $a, $b )
    private static function sort($a, $b)
    {
        $a_is_dir = isset($a['files']);
        $b_is_dir = isset($b['files']);
        // dir > file
        if ($a_is_dir && !$b_is_dir) {
            return -1;
        } else {
            if (!$a_is_dir && $b_is_dir) {
                return 1;
            }
        }
        return strcasecmp($a['name'], $b['name']);
    }