protected function compareTypes($a, $b)
    {
        // compare entry type order
        $type_order = $this->getTypeOrder();

        if (!array_key_exists($a, $type_order)) {
            $a = '__unknown__';
        }

        if (!array_key_exists($b, $type_order)) {
            $b = '__unknown__';
        }

        if ($type_order[$a] > $type_order[$b]) {
            return 1;
        }

        if ($type_order[$a] < $type_order[$b]) {
            return -1;
        }

        return 0;
    }