2016-05-24 12:10:39 +00:00
|
|
|
<?php namespace Moserware\Skills;
|
2010-09-18 15:11:44 +00:00
|
|
|
|
2010-08-29 02:05:41 +00:00
|
|
|
class RatingContainer
|
|
|
|
{
|
2010-09-18 15:11:44 +00:00
|
|
|
private $_playerToRating;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
2010-09-25 22:25:56 +00:00
|
|
|
$this->_playerToRating = new HashMap();
|
2010-09-18 15:11:44 +00:00
|
|
|
}
|
2010-08-29 02:05:41 +00:00
|
|
|
|
2010-10-03 01:15:47 +00:00
|
|
|
public function &getRating(Player &$player)
|
2010-08-29 02:05:41 +00:00
|
|
|
{
|
2010-09-30 12:25:31 +00:00
|
|
|
$rating = &$this->_playerToRating->getValue($player);
|
|
|
|
return $rating;
|
2010-08-29 02:05:41 +00:00
|
|
|
}
|
|
|
|
|
2010-10-03 01:15:47 +00:00
|
|
|
public function setRating(Player &$player, Rating $rating)
|
2010-08-29 02:05:41 +00:00
|
|
|
{
|
2010-09-18 15:11:44 +00:00
|
|
|
return $this->_playerToRating->setValue($player, $rating);
|
2010-08-29 02:05:41 +00:00
|
|
|
}
|
2016-05-24 12:10:39 +00:00
|
|
|
|
2010-10-03 01:15:47 +00:00
|
|
|
public function &getAllPlayers()
|
2010-08-29 02:05:41 +00:00
|
|
|
{
|
2010-10-03 01:15:47 +00:00
|
|
|
$allPlayers = &$this->_playerToRating->getAllKeys();
|
|
|
|
return $allPlayers;
|
2010-08-29 02:05:41 +00:00
|
|
|
}
|
2016-05-24 12:10:39 +00:00
|
|
|
|
2010-10-03 01:15:47 +00:00
|
|
|
public function &getAllRatings()
|
2010-08-29 02:05:41 +00:00
|
|
|
{
|
2010-10-03 01:15:47 +00:00
|
|
|
$allRatings = &$this->_playerToRating->getAllValues();
|
|
|
|
return $allRatings;
|
2010-08-29 02:05:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function count()
|
|
|
|
{
|
2010-10-04 00:17:34 +00:00
|
|
|
return $this->_playerToRating->count();
|
2016-05-24 12:10:39 +00:00
|
|
|
}
|
|
|
|
}
|