Gollem::sortType PHP Method

sortType() public static method

Internal sorting function for 'type'.
public static sortType ( $a, $b )
    public static function sortType($a, $b)
    {
        $dirs = self::_sortDirs($a, $b);
        if ($dirs) {
            return $dirs;
        }
        if ($a['type'] === $b['type']) {
            return self::sortName($a, $b);
        } elseif ($a['type'] === '**dir') {
            return $GLOBALS['prefs']->getValue('sortdir') ? 1 : -1;
        } elseif ($b['type'] === '**dir') {
            return $GLOBALS['prefs']->getValue('sortdir') ? -1 : 1;
        } else {
            $res = strcasecmp($a['type'], $b['type']);
            return $GLOBALS['prefs']->getValue('sortdir') ? $res * -1 : $res;
        }
    }