Gollem::_sortDirs PHP Method

_sortDirs() protected static method

Internal helper to sort directories first if pref set.
protected static _sortDirs ( $a, $b )
    protected static function _sortDirs($a, $b)
    {
        /* Sort symlinks to dirs as dirs */
        $dira = $a['type'] === '**dir' || $a['type'] === '**sym' && $a['linktype'] === '**dir';
        $dirb = $b['type'] === '**dir' || $b['type'] === '**sym' && $b['linktype'] === '**dir';
        if ($GLOBALS['prefs']->getValue('sortdirsfirst')) {
            if ($dira && !$dirb) {
                return -1;
            } elseif (!$dira && $dirb) {
                return 1;
            }
        }
        return 0;
    }