2022-07-05 15:55:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DNW\Skills;
|
2010-09-18 11:11:44 -04:00
|
|
|
|
2010-08-28 22:05:41 -04:00
|
|
|
class RatingContainer
|
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
private HashMap $playerToRating;
|
2010-09-18 11:11:44 -04:00
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
$this->playerToRating = new HashMap();
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
2010-08-28 22:05:41 -04:00
|
|
|
|
2023-08-02 09:04:56 +00:00
|
|
|
public function getRating(Player $player): Rating
|
2010-08-28 22:05:41 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->playerToRating->getValue($player);
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
|
|
|
|
2023-08-01 12:56:37 +00:00
|
|
|
public function setRating(Player $player, Rating $rating): HashMap
|
2010-08-28 22:05:41 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->playerToRating->setValue($player, $rating);
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
2016-05-24 14:10:39 +02:00
|
|
|
|
2023-08-01 12:56:37 +00:00
|
|
|
public function getAllPlayers(): array
|
2010-08-28 22:05:41 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->playerToRating->getAllKeys();
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
2016-05-24 14:10:39 +02:00
|
|
|
|
2023-08-01 12:56:37 +00:00
|
|
|
public function getAllRatings(): array
|
2010-08-28 22:05:41 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->playerToRating->getAllValues();
|
2010-08-28 22:05:41 -04:00
|
|
|
}
|
|
|
|
|
2023-08-01 12:56:37 +00:00
|
|
|
public function count(): int
|
2010-08-28 22:05:41 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->playerToRating->count();
|
2016-05-24 14:10:39 +02:00
|
|
|
}
|
2016-05-24 15:12:29 +02:00
|
|
|
}
|