2010-08-28 22:05:41 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Moserware\Skills;
|
|
|
|
|
2010-10-08 21:44:36 -04:00
|
|
|
/**
|
|
|
|
* Helper class to sort ranks in non-decreasing order.
|
|
|
|
*/
|
2010-08-28 22:05:41 -04:00
|
|
|
class RankSorter
|
|
|
|
{
|
2010-10-08 21:44:36 -04:00
|
|
|
/**
|
|
|
|
* Performs an in-place sort of the items in according to the ranks in non-decreasing order.
|
|
|
|
*
|
|
|
|
* @param $items The items to sort according to the order specified by ranks.
|
|
|
|
* @param $ranks The ranks for each item where 1 is first place.
|
|
|
|
*/
|
2010-08-28 22:05:41 -04:00
|
|
|
public static function sort(array &$teams, array &$teamRanks)
|
|
|
|
{
|
|
|
|
array_multisort($teamRanks, $teams);
|
|
|
|
return $teams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|