/** * Sorts item's children right before rendering * @return array */ public static function sortItems(NavigationNode $component) { $items = (array) $component->getComponents(); switch ($component->getSortBy()) { case self::SORT_NONE: break; case self::SORT_PRIORITY: usort($items, array(get_class(), 'comparePriority')); break; case self::SORT_PRIORITY_INTEGER: usort($items, array(get_class(), 'comparePriorityInteger')); break; case self::SORT_PRIORITY_STRING: usort($items, array(get_class(), 'comparePriorityString')); break; case self::SORT_LABEL: usort($items, array(get_class(), 'compareLabel')); break; } return $items; }