1 | <?php |
||
5 | class Ballot |
||
6 | { |
||
7 | /** |
||
8 | * Ranking of candidates ids |
||
9 | * |
||
10 | * @var integer[] |
||
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 integer[] $ranking The ranking of candidates Key being ranking, |
||
32 | * value being a candidate id |
||
33 | */ |
||
34 | 3 | public function __construct(array $ranking) |
|
40 | |||
41 | /** |
||
42 | * Gets the Ranking of candidates ids. |
||
43 | * |
||
44 | * @return array |
||
45 | */ |
||
46 | 1 | 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 | public 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 | 1 | 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 | * @return float $weight The inputted weight |
||
80 | */ |
||
81 | public function setWeight(float $weight): float |
||
87 | |||
88 | /** |
||
89 | * Gets the the current preference in use from this ballot. |
||
90 | * |
||
91 | * @return integer |
||
92 | */ |
||
93 | 1 | public function getLevelUsed(): int |
|
97 | |||
98 | /** |
||
99 | * Sets the the current preference in use from this ballot. |
||
100 | * |
||
101 | * @param integer $levelUsed |
||
102 | * |
||
103 | * @return self |
||
104 | */ |
||
105 | public function setLevelUsed(int $levelUsed) |
||
111 | |||
112 | public function getLastChoice() |
||
123 | |||
124 | public function getNextChoice() |
||
135 | } |
||
136 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.