| 1 | <?php |
||
| 5 | class Ballot |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Ranking of candidates ids |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $ranking; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * The current weighting or value of this person's vote |
||
| 16 | * |
||
| 17 | * @var float |
||
| 18 | */ |
||
| 19 | protected $weight; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * The current preference in use from this ballot |
||
| 23 | * |
||
| 24 | * @var integer |
||
| 25 | */ |
||
| 26 | protected $levelUsed; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Constructor |
||
| 30 | * |
||
| 31 | * @param array $ranking The ranking of candidates Key being ranking, |
||
| 32 | * value being a candidate id |
||
| 33 | */ |
||
| 34 | public function __construct(array $ranking) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Gets the Ranking of candidates ids. |
||
| 43 | * |
||
| 44 | * @return array |
||
| 45 | */ |
||
| 46 | public function getRanking(): array |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Sets the Ranking of candidates ids. |
||
| 53 | * |
||
| 54 | * @param array $ranking the ranking |
||
| 55 | * |
||
| 56 | * @return self |
||
| 57 | */ |
||
| 58 | protected function setRanking(array $ranking) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Gets the The current weighting or value of this person's vote. |
||
| 67 | * |
||
| 68 | * @return float |
||
| 69 | */ |
||
| 70 | public function getWeight(): float |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Sets the The current weighting or value of this person's vote. |
||
| 77 | * |
||
| 78 | * @param float $weight the weight |
||
| 79 | * |
||
| 80 | * @return self |
||
| 81 | */ |
||
| 82 | protected function setWeight(float $weight) |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Gets the the current preference in use from this ballot. |
||
| 91 | * |
||
| 92 | * @return integer |
||
| 93 | */ |
||
| 94 | public function getLevelUsed(): int |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Sets the the current preference in use from this ballot. |
||
| 101 | * |
||
| 102 | * @param integer $levelUsed |
||
| 103 | * |
||
| 104 | * @return self |
||
| 105 | */ |
||
| 106 | protected function setLevelUsed(int $levelUsed) |
||
| 112 | } |
||
| 113 |